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

SQL֮ʮ profiler

Microsoft SQL Server Profiler ÊÇ SQL ¸ú×ÙµÄͼÐÎÓû§½çÃ棬ÓÃÓÚ¼àÊÓ Êý¾Ý¿âÒýÇæ»ò Analysis Services µÄʵÀý¡£Äú¿ÉÒÔ²¶»ñÓйØÿ¸öʼþµÄÊý¾Ý²¢½«Æä±£´æµ½Îļþ»ò±íÖй©ÒÔºó·ÖÎö¡£ÀýÈ磬¿ÉÒÔ¶ÔÉú²ú»·¾³½øÐмàÊÓ£¬Á˽âÄÄЩ´æ´¢¹ý³ÌÓÉÓÚÖ´ÐÐËÙ¶ÈÌ«ÂýÓ°ÏìÁËÐÔÄÜ¡£
¿ÉÒÔʹÓà SQL Server ProfilerÀ´´´½¨Ä£°å£¬¶¨ÒåÒª°üº¬ÔÚ¸ú×ÙÖеÄʼþÀàºÍÊý¾ÝÁС£¶¨Òå²¢±£´æÄ£°åºó£¬¿ÉÒÔÔËÐиú×ÙÀ´¼Ç¼ÿ¸öÑ¡¶¨Ê¼þÀàµÄÊý¾Ý¡£Äú¿ÉÒÔ½«Ò»¸öÄ£°åÓÃÓÚ¶à¸ö¸ú×Ù£»Ä£°å±¾Éí²¢²»»áÖ´ÐС£
SQL Server Profiler¿ÉÏÔʾ SQL Server ÈçºÎÔÚÄÚ²¿½âÎö²éѯ¡£Õâ¾Íʹ¹ÜÀíÔ±Äܹ»×¼È·²é¿´Ìá½»µ½·þÎñÆ÷µÄ Transact-SQL Óï¾ä»ò¶àά±í´ïʽ£¬ÒÔ¼°·þÎñÆ÷ÊÇÈçºÎ·ÃÎÊÊý¾Ý¿â»ò¶àάÊý¾Ý¼¯ÒÔ·µ»Ø½á¹û¼¯µÄ¡£


Ïà¹ØÎĵµ£º

SQL²âÊÔ ½»¼¯¡¢²¢¼¯¡¢²î¼¯¡¢µÑ¿¨¶û»ý

²¢¼¯:
ʹÓà UNION ÔËËã·û×éºÏ¶à¸ö½á¹û
SELECT name,num from Table1
UNION
SELECT name,num from Table2
×¢Ò⣺²éѯµÄ×ֶθöÊý±ØÐëÏàͬ£¬Table2µÄ×Ö¶ÎÀàÐÍÒª¸úTable1µÄÏàͬ.
Èç¹ûʹÓà UNION ÔËËã·û£¬ÄÇôµ¥¶ÀµÄ SELECT Óï¾ä²»ÄÜ°üº¬Æä×Ô¼ºµÄ ORDER BY »ò COMPUTE ×Ӿ䡣ֻÄÜÔÚ×îºóÒ»¸ö SELECT Óï¾äµÄºóÃæʹÓÃÒ»¸ö ORD ......

SQL Óï¾äÁ·Ï°


–1¡¢²éÕÒÔ±¹¤µÄ±àºÅ¡¢ÐÕÃû¡¢²¿ÃźͳöÉúÈÕÆÚ£¬Èç¹û³öÉúÈÕÆÚΪ¿ÕÖµ£¬ÏÔʾÈÕÆÚ²»Ïê,²¢°´²¿ÃÅÅÅÐòÊä³ö,ÈÕÆÚ¸ñʽΪyyyy-mm-dd¡£
select emp_no,emp_name,dept,isnull(convert(char(10),birthday,120),’ÈÕÆÚ²»Ïê’) birthday
from employee
order by dept
–2¡¢²éÕÒÓëÓ÷×ÔÇ¿ÔÚͬһ¸öµ¥Î»µÄÔ±¹¤ÐÕÃû¡¢ ......

SQL Server ´æ´¢¹ý³ÌÈëÃÅѧϰ

´´½¨´æ´¢¹ý³Ì֮ǰҪÏÈÓÃuseÓï¾äÉùÃ÷Òª½«´æ´¢¹ý³Ì´æ´¢ÔÚÄĸöÊý¾Ý¿âÖÐ. e.g use company; Ö´ÐÐÖ®.Ö®ºó¾Í¿ÉÒÔÉùÃ÷´æ´¢¹ý³ÌÁË. e.g create procedure *** @id varchar(50) , @name int output as select @name=name from table where id=@id È»ºó¿ÉÒÔÓÃalter¶Ô´æ´¢¹ý³Ì½øÐÐÐÞ¸Ä. declare¿ÉÒÔÉùÃ÷Ò»¸ö±äÁ¿ ÓÃset¶Ô±ä ......

sql group by Óë havingµÄÓ÷¨

1. GROUP BY ÊÇ·Ö×é²éѯ, Ò»°ã GROUP BY ÊǺ;ۺϺ¯ÊýÅäºÏʹÓÃ
group by ÓÐÒ»¸öÔ­Ôò,¾ÍÊÇ select ºóÃæµÄËùÓÐÁÐÖÐ,ûÓÐʹÓþۺϺ¯ÊýµÄÁÐ,±ØÐë³öÏÖÔÚ group by ºóÃ棨ÖØÒª£©
ÀýÈç,ÓÐÈçÏÂÊý¾Ý¿â±í£º
A    B
1    abc
1    bcd
1    asdfg
 Èç¹ûÓÐÈ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ