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

DBAµÄSQL Server 2005±¸·Ýά»¤¼Æ»®

×÷ΪһÃûDBA£¬ËûÃÇ×î³£¼ûµÄÈÕ³£ÈÎÎñÊÇ£º
1£©¶¨ÆÚÍê³ÉÊý¾Ý¿âµÄÍêÈ«±¸·Ý»ò²îÒ챸·Ý¡£
2£©¶¨ÆÚÇåÀí±¸·ÝÎļþ£¬ÒòΪ´æ´¢¿Õ¼äÓÐÏÞ£¬¿ÉÄÜÖ»ÐèÒª±£´æÒ»¸öʱÆÚ¶ÎÄÚµÄÎļþ(±ÈÈçÒ»ÖÜÄÚ»òÒ»ÔÂÄÚ)¡£
¶øÈçºÎ×öµ½ÕâÁ½µãÄØ£¿±ÊÕßÏàÐÅÔÚSQL SERVER2005°æ±¾³öÀ´Ö®Ç°ÒªÊµÏÖÕâÖÖ¹¦ÄÜ£¬ Ò²ÊÇ¿ÉÒÔʵÏֵģ¬Ö»ÊÇʵÏÖ¶¨ÆÚÇåÀí±¸·ÝÎļþÏԵò»ÄÇôֱ½Ó£¬Ò»°ãÐèÒªÊÖдÅú´¦Àí×÷ҵά»¤£¬¶øÔÚSQL Server 2005°æ±¾ÖУ¬ÕâЩ¹¦ÄÜÒѾ­±»Éè¼Æ³ÉΪԤÖƵÄ×é¼þ£¬Ö»ÐèÒªÔÚÊý¾Ýά»¤¼Æ»®ÖнøÐÐÍÏק²¢ÉèÖÃÏà¹ØÊôÐԾͿÉÒÔÁË£¬Ïà¹Ø²½ÖèÈçÏ£º
µÚÒ»²½£ºÐ½¨Î¬»¤¼Æ»®
ͼ1
 
ÔÚ·þÎñÆ÷ ¹ÜÀí\ά»¤¼Æ»®Êó±êÓÒ¼üµã»÷н¨Î¬»¤¼Æ»®¡£  
µÚ¶þ²½£ºÉè¼Æά»¤¼Æ»®
2.1 ÍÏק ά»¤¼Æ»®ÖеÄÈÎÎñ¹¤¾ßÏä µÄ“±¸·ÝÊý¾Ý¿âÈÎÎñ”µ½Î¬»¤¼Æ»®Éè¼ÆÆ÷¡£
2.2 ÍÏק ά»¤¼Æ»®ÖеÄÈÎÎñ¹¤¾ßÏä µÄ“Çå³ýÀúÊ·¼Ç¼ÈÎÎñ”µ½Î¬»¤¼Æ»®Éè¼ÆÆ÷¡£
2.3ÍÏק ά»¤¼Æ»®ÖеÄÈÎÎñ¹¤¾ßÏä µÄ“Çå³ýÀúÊ·¼Ç¼ÈÎÎñ”µ½Î¬»¤¼Æ»®Éè¼ÆÆ÷¡£
ÈçÏÂͼËùʾ£º
ͼ2
Êó±êÓÒ¼üµã»÷±à¼­ “±¸·ÝÊý¾Ý¿â”ÈÎÎñ¿ÉÉèÖÃÊôÐÔ£¬ÈçÏÂͼ£º
ͼ3
±¾ÈÎÎñ½«×Ô¶¯Íê³ÉÊý¾Ý¿âµÄÍêÕû±¸·Ý×÷Òµ¡£
Êó±êÓÒ¼üµã»÷±à¼­“Çå³ýÀúÊ·¼Ç¼”ÈÎÎñ£¬ÈçÏÂͼ£º
ͼ4
±¾ÈÎÎñ×Ô¶¯Íê³É”Çå³ýÀúÊ·¼Ç¼”×÷Òµ¡£
Êó±êÓÒ¼üµã»÷±à¼­“Çå³ýά»¤”ÈÎÎñ£¬ÈçÏÂͼ£º
ͼ5
±¾ÈÎÎñ×Ô¶¯Íê³ÉÇå³ýÀúÊ·±¸·ÝÎļþµÄ×÷Òµ¡£
±¾Î¬»¤¼Æ»®ÈÎÎñµÄ×÷Òµ¼Æ»®ÊôÐÔÉèÖÃÈçÏ£º
ͼ6
±¾²½ÖèÍê³ÉÁË×÷ÒµÊôÐÔµÄÉèÖá£ÏµÍ³½«°´ÕÕÉèÖö¨ÆÚÔËÐÐά»¤×÷Òµ¡£
µÚÈý²½£º±£´æά»¤¼Æ»®
µ½´Ë£¬Ö»ÐèÒª²é¿´ÈÕÖ¾¼Ç¼£¬¾Í¿ÉÒÔ¸ú×Ù±¾¼Æ»®µÄÍê³ÉÇé¿ö£¬¸ù¾Ý³É¹¦¼Ç¼Óë·ñ¿ÉÒÔµ÷ÕûºÍÐ޸ı¾Î¬»¤¼Æ»®¡£
DBAÃǾ­³£Ê¹ÓõÄSQL Server 2005×î³£Óõı¸·Ýά»¤¼Æ»®£¬¾ÍÊÇÕâô¼òµ¥£¡
Tag±êÇ©: SQL Server 2005,±¸·Ýά»¤¼Æ»®


Ïà¹ØÎĵµ£º

´ÓËã·¨ÈëÊÖ½²½âSQL ServerµÄµäÐÍʾÀý

 ServerÊý¾Ý¿âÖÐʵÏÖ×îÓÅ×î¼òµÄÕû¸ö¹ý³Ì¡£
Ëã·¨ÊǼÆËã»ú¿ÆѧÖÐÒ»¸öÖØÒªµÄÑо¿·½Ïò£¬Êǽâ¾ö¸´ÔÓÎÊÌâµÄ¹Ø¼ü¡£ÔÚ¼ÆËã»úÊÀ½çÖУ¬Ëã·¨ÎÞ´¦²»ÔÚ¡£Êý¾Ý¿âÊÇ´æ´¢Êý¾ÝºÍÖ´ÐдóÅúÁ¿¼ÆËãµÄ³¡Ëù£¬ÔÚÊý¾Ý¿âÖÐʹÓÃһЩ¼òµ¥µÄSQLÃüÁ½øÐд洢¡¢²éѯ¡¢Í³¼Æ¡¢ÒÔ½â¾öÏÖʵÊÀ½çÖеÄÎÊÌâÒѾ­ÊÇÂżû²»ÏÊ¡£Ëæ×ÅÊý¾ÝÁ¿µÄ´ó·ù¶ÈÔö¼ÓºÍÒµÎñ¹æ ......

¾«ÃîSQLÓï¾ä

 1.°´ÐÕÊϱʻ­ÅÅÐò:
Select * from TableName Order By CustomerName Collate Chinese_PRC_Stroke_ci_as
2.·ÖÒ³SQLÓï¾ä
select * from(select (row_number() OVER (ORDER BY tab.ID Desc)) as rownum,tab.* from ±íÃû As tab) As t where rownum between ÆðʼλÖà And ½áÊøλÖÃ
3.»ñÈ¡µ±Ç°Êý¾Ý¿âÖеÄËùÓÐÓû§± ......

¶¯Ì¬SQL»ù±¾Óï·¨

1 :ÆÕͨSQLÓï¾ä¿ÉÒÔÓÃexecÖ´ÐÐ
Select * from tableName
exec('select * from tableName')
exec sp_executesql N'select * from tableName' -- Çë×¢Òâ×Ö·û´®Ç°Ò»¶¨Òª¼ÓN
2:×Ö¶ÎÃû£¬±íÃû£¬Êý¾Ý¿âÃûÖ®Àà×÷Ϊ±äÁ¿Ê±£¬±ØÐëÓö¯Ì¬SQL
declare @fname varchar(20)
set @fname = 'FiledName'
Select @fname from tab ......

Éè¼Æ¸ßЧsqlÒ»°ã¾­Ñé̸ £¨×ª£©

1²»ÓÃÔÚsqlÓï¾äʹÓÃϵͳĬÈϵı£Áô¹Ø¼ü×Ö
2¾¡Á¿ÓÃexists ºÍ not exists ´úÌæ in ºÍ not in
         ÕâÌõÔÚsql2005Ö®ºó£¬ÔÚË÷ÒýÒ»Ñù£¬Í³¼ÆÐÅÏ¢Ò»ÑùµÄÇé¿öÏ£¬exists £¬inЧ¹ûÊÇÒ»ÑùµÄ¡£
         ÒÔAdventureWorksÊý¾Ý¿âΪÀý£¬²éѯÔÚH ......

SQL ServerÐÔÄܵĸĽøµÃÒæÓÚÂß¼­Êý¾Ý¿âÉè¼Æ (ת)

¡ô1¡¢Ê¹ÓÃË÷ÒýÀ´¸ü¿ìµØ±éÀú±í
 
ȱʡÇé¿öϽ¨Á¢µÄË÷ÒýÊÇ·ÇȺ¼¯Ë÷Òý£¬µ«ÓÐʱËü²¢²»ÊÇ×î¼ÑµÄ¡£ÔÚ·ÇȺ¼¯Ë÷ÒýÏ£¬Êý¾ÝÔÚÎïÀíÉÏËæ»ú´æ·ÅÔÚÊý¾ÝÒ³ÉÏ¡£ºÏÀíµÄË÷ÒýÉè¼ÆÒª½¨Á¢ÔÚ¶Ô¸÷ÖÖ²éѯµÄ·ÖÎöºÍÔ¤²âÉÏ¡£Ò»°ãÀ´Ëµ£º¢Ù.ÓдóÁ¿Öظ´Öµ¡¢ÇÒ¾­³£Óз¶Î§²éѯ£¨between, > ,< £¬> =,< =£©ºÍorder by¡¢group by·¢ÉúµÄÁÐ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ