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

ÔÚSQL ServerÖÐÈçºÎÊä³öÐкÅ


Ô­ÎĵØÖ·£ºhttp://www.dingos.cn/index.php?topic=1688.0
OracleÓÐrownumÓÃÓÚ·ÃÎʱíÖÐÐкš£ÄÇôÔÚSQL ServerÖÐÊÇ·ñÓеÈЧµÄÄØ£¿»òÕßÔÚSQL ServerÖÐÈçºÎÊä³öÐкţ¿
-----------------------------------
ÔÚSQL ServerÖÐûÓÐÖ±½ÓµÈЧÓÚOracleµÄrownum
-----------------------------------
Ñϸñ˵À´£¬ÔÚ¹ØϵÊý¾Ý¿âÖУ¬±íÖеÄÐÐÊÇûÓÐÐòµÄ²¢ÇÒÐкÅûÓÐÕýÕæµÄÒâÒå¡£Èç¹ûÐèÒªÕâ¸ö¹¦ÄÜ£¬¿ÉÒÔÓÐÈçÏÂÈýÖÖ¿¼ÂÇ£º
ÔÚ±íÖÐÌí¼ÓÒ»¸ö×Ô¶¯Ôö³¤ÁС£
ʹÓÃÏÂÁвéѯΪÿһÐвúÉúÒ»¸öÐкš£ÏÂÁвéѯΪpubsÊý¾Ý¿âÿһÐвúÉúÒ»¸öÐкš£ÎªÕâ¸ö²éѯ¹¤×÷£¬Õâ¸ö±í±ØÐëӴΨһԼÊø¡£
-----------------------------------------------
SELECT (SELECT COUNT(i.au_id)
from pubs..authors i
WHERE i.au_id >= o.au_id ) AS RowID,
au_fname + ' ' + au_lname AS 'Author name'
from pubs..authors o
ORDER BY RowID
-----------------------------------------
ʹÓÃÁÙʱ±íʵÏÖ£¬½«Õû¸ö½á¹û¼¯´æ´¢ÔÚÒ»¸öÁÙʱ±íÖУ¬¸úÓÐÒ»¸öÓÉIDENTITY()º¯Êý²ÎÊýµÄÐкš£´´½¨ÁÙʱ±í´ú¼ÛÊDZȽϰº¹óµÄ£¬ÓÈÆäÊǶԱȽϴóµÄ±í½øÐвÙ×÷¡£


Ïà¹ØÎĵµ£º

DB2 ´¿SQL´æ´¢¹ý³ÌÓ뺯ÊýµÄһЩÏÞÖÆ

*¸ø¶à¸ö±äÁ¿¸³Öµ
functionÖ»ÄÜʹÓÃ
set (a,b,c)=(select a,b,c from #);
procedureÖ»ÄÜʹÓÃ
select a,b,c into a,b,c from #
*functionÎÞ·¨Ç¶Ì×µ÷ÓôøÓÐinout»òout²ÎÊýµÄprocedure£¬ÏÖÏóΪ£ºÎÞ·¨´´½¨¡£
 ½ñÌìµÄ½øÕ¹½áÂÛÊÇ£º
function¿ÉÒÔµ÷ÓÃÈκÎprocedure£¬µ«±ØÐëÉùÃ÷Ϊmodifies sql data£¬Í¬Ê±±ØÐë·µ»Øtable ......

SQLµÝ¹éÁ½ÕÅÊý¾Ý±í

²¿ÃŽṹ
Id name parentId
-----------------
1 ÈËʲ¿ 0
2
¿ª·¢²¿ 1
3 ·þÎñ²¿ 1
Óû§½á¹¹
Id name departId
--------------------
101
ÕÅÈý 2
102 ÀîËÄ 2
103 ÍõÎå 3
ÏëµÃµ½
ID name
parentId
-------------------
1 ÈËʲ¿ 0
2 ¿ª·¢²¿ 1
101
ÕÅ ......

SQL SERVER 2005 ÈçºÎÆô¶¯·þÎñ

1.¡¸¿ªÊ¼¡¹²Ëµ¥->ÔËÐÐ
--Æô¶¯sql server 2005 ·þÎñ
net start mssqlserver
--Í£Ö¹sql server 2005 ·þÎñ
net stop mssqlserver
2.¡¸¿ªÊ¼¡¹²Ëµ¥->³ÌÐò->Microsoft SQL Server 2005->ÅäÖù¤¾ß
SQL Server Configuration Manager->SQL Server(MSSQLSERVER) ÓÒ»÷ Æô¶¯·þÎñ³É¹¦ºó£¬×´Ì¬ÏÔʾΪ“ÕýÔÚÔËÐ ......

SQLÊý¾Ý¿â˵Ã÷Êé

ÅäÖÃÔ´³ÌÐò
¸½¼ÓÊý¾Ý¿âSQL Server 2005
£¨1£©½«TM\01\App_DataÎļþ¼ÐÖеÄdb_SIS.mdfºÍdb_SIS_log.ldfÎļþ¿½±´µ½SQL Server 2005°²×°Â·¾¶ÏµÄMSSQL.1\MSSQL\DataĿ¼Ï¡£
£¨2£©Ñ¡Ôñ¿ªÊ¼/³ÌÐò/Microsoft SQL Server 2005/SQL Server Management StudioÏ½øÈëµ½“Á¬½Óµ½·þÎñÆ÷”Ò³Ã棬Èçͼ1.1Ëùʾ¡£
ͼ1.1&nbs ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ