Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

PowerShell±Ê¼Ç£¨Èý£©£ºµ÷ÓÃMS SQLÊý¾Ý¿â

ÊÔÁËÒ»°ÑPowerShell·ÃÎÊÊý¾Ý¿â£¬¸úÓÃC#д¼¸ºõûÈκÎÇø±ð~
ΪÁ˼òµ¥Æð¼û£¬´úÂëÓеã³ó£¬²»ÓÃÌ«É
$ConnString = "server=_SERVER_;database=_DATABASE_;user id=_UID_;password=_PWD_";
$db = New-Object System.Data.SqlClient.SqlConnection($ConnString);
$db.Open();
$Sql = "select top 10 * from sys.objects where type='U' order by [Name]";
$cmd = New-Object System.Data.SqlClient.SqlCommand($Sql,$db);
$r = $cmd.ExecuteReader();
$a = "","";
while ($r.Read())
{
 $a = $a + $r["Name"].ToString();
}
$r.Close();
$cmd.Dispose();
$db.Close();
$db.Dispose();
echo $a


Ïà¹ØÎĵµ£º

AMD ÈýºË´¦ÀíÆ÷°²×°SQL Server2005³ö´í´¦Àí½â¾ö·½°¸¡£

     ×î½üѧSQL Server2005£¬ÏÂÔØÁËSQL2005ÖÐÎÄ¿ª·¢°æ£¬µ«ÊÇͬѧÃǶ¼°²×°ÉÏÁË£¬Î¨¶ÀÎҵĻúÆ÷°²×°²»ÉÏ¡£
     ÿ´Î°²×°DATABASEµÄʱºò¶¼ÌáʾÎÞ·¨Æô¶¯sqlservr.exe·þÎñÎÞ·¨Æô¶¯£¬ÖØ×°ÏµÍ³Ò²²»ÐУ¬WINXP WIN 7ÏÂÃæ¶¼ÎÞ·¨°²×°£¬ÓÚÊÇÉÏÍø²éÁËÏ£¬Ô­À´SQL2005²»Ö§³Ö3ºË´¦ÀíÆ÷£¬Î¢ÈíÒ²×Ô ......

ÖÕ¼¶½â¾öSQL Server 2005 δÕý³£Ð¶ÔØ£¬ÖØÐ°²×°ÎÊÌâ

 ÔÚÐ¶ÔØVisual Studio 2008 ʱ£¬Ìí¼Ó/ɾ³ý³ÌÐò ÀïÃæÓÐÐí¶àµÄ°²×°Îļþ£¬´ËʱÈç¹ûûÓÐÏÈÐ¶ÔØSQL Server 2005 £¬
¶øÏÈÐ¶ÔØ.Net Framework£¨Ìáʾ£ºÐ¶ÔØ.net FrameworkµÄµÃ°²°æ±¾´Ó¸ßµ½µÍµÄ˳Ðò£©£¬
ÕâʱSQL Server 2005¾ÍÎÞ·¨Ð¶ÔØ,ɾ³ýProgram files ÏÂÃæµÄ Microsoft SQL Server Îļþ¼ÐҲûÓÐ×÷Óá£
ÖØÐ°²×°ÌáʾÊý¾Ý¿ ......

̸̸ SQL Êý¾Ý¿âµÄ±¸·ÝÓ뻹ԭ

 ¡¾Ñ§Ï°µãµãµÎµÎ¡¿ ÔںܶàÇé¿öÓë»·¾³ÖУ¬ÎÒÃǶ¼Òª¶ÔÒÑÓеÄÊý¾Ý¿â½øÐб¸·Ý£¬ÕâÑùÒÔ·ÀÖ¹µ±ÎÒÃÇÒòÈËΪ»òÕß·þÎñÆ÷µÈÖî¶àÔ­Òò¶øµ¼ÖµÄÊý¾Ý¶ªÊ§£¬
   ´Ó¶ø¸øÎÒÃÇ´øÀ´ºÜ´óµÄÂé·³£¬ÎÒÒ²ÊǽӴ¥SQLû¶à³¤Ê±¼ä£¬¶ÔÓëËüÇ¿´óµÄÊý¾Ý¿É»Ö¸´¹¦ÄÜ Ò²Ö»ÊÇÂÔÖªÒ»¶þ£¬µ±È»ÔÚÕâÀïÒ²Ö»ÊÇ×ö¶ÔËü×öÂÔÂԵļǼ£¬
  ´¿´âÊÇ ......

SQLÓï¾ä½Ì³Ì

ÔÚÕâÒ»Ò³ÖУ¬ÎÒÃÇÁгöËùÓÐÔÚÕâ¸öÍøÕ¾ÓÐÁгö SQL Ö¸ÁîµÄÓï·¨¡£ÈôÒª¸üÏ꾡µÄ˵Ã÷£¬ÇëµãѡָÁîÃû³Æ¡£
ÕâÒ»Ò³µÄÄ¿µÄÊÇÌṩһ¸ö¼ò½àµÄ SQL Óï·¨×öΪ¶ÁÕ߲ο¼Ö®Óá£ÎÒÃǽ¨ÒéÄúÏÖÔھͰ´ Control-D ½«±¾Ò³¼ÓÈëÄúµÄ¡ºÎÒµÄ×î°®¡»¡£
Select
SELECT "À¸Î»" from "±í¸ñÃû"
Distinct
SELECT DISTINCT "À¸Î»"
from "±í¸ñÃû"
Where
......

SQL IN ת»¯Îª EXISTS µÄ·½·¨

·Ï»°ÉÙ˵,(ÒѾ­Óоä·Ï»°ÁË.)
¿´±í
 Óï¾ä: SELECT * from C
//---------------------------------------
Cno  Cname      Teacher
---- ---------- --------
1    ÓïÎÄ         Æî¾²   
2  &n ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ