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

»ñÈ¡SQL ServerµÄһЩϵͳÐÅÏ¢

 --@@CPU_BUSY»ñÈ¡cpu¹¤×÷ʱ¼ä
select @@CPU_BUSY AS 'CPU ms',GETDATE() AS 'TIMES'
--»ñÈ¡´ÅÅ̶Áд´ÎÊý
SELECT @@TOTAL_READ AS 'Reads',@@TOTAL_WRITE AS 'Writes', GETDATE() AS 'As of'
--»ñÈ¡SQl·þÎñÆ÷Ãû
SELECT HOST_NAME()
--»ñµÃÊý¾Ý¿â±íʾºÅ
USE master
SELECT name,DB_ID(name) AS DB_ID from sysdatabases
--ÅжÏÓû§ÊÇ·ñ¾ßÓзÃÎÊÊý¾Ý¿âȨÏÞ
SELECT HAS_DBACCESS('master')
--ÏÔʾ±íÖÐÁ㤶ÈÐÅÏ¢
SELECT COL_LENGTH('student','stuEnglish')
--»ñÈ¡Á¬½Ó»òÊÔͼÁ¬½ÓµÄ´ÎÊý
SELECT GETDATE() AS 'Today Date and Time',@@CONNECTIONS AS 'Login Attemps'
--»ñÈ¡µ±Ç°Êý¾Ý¿âÓïÑÔ
SELECT @@LANGUAGE AS 'Language Name'
--Ìá¸ßSQLÐÔÄܼӿìÖ´ÐÐËÙ¶È
--µ«SET NOCOUNT ΪON£¬²»·µ»Ø¼ÆÊý£¬µ«SET NOCOUNTΪOFFÊÇ·µ»Ø¼ÆÊý¡£
--¼´Ê¹µ±SET NOCOUNTΪONʱ£¬Ò²¸üÐÂ@@ROWCOUNTº¯Êý£¬½«²»¸ø¿Í»§¶Ë·¢
--ËÍ´æ´¢¹ý³ÌÖеÄÿ¸öÓï¾äµÄDONEIN_PROC
--¿ØÖÆÅú´¦ÀíÓï¾äµÄÖ´ÐÐ
--µ±SET NOEXECΪONʱSQL Server±àÒëÿ¸öÅú´¦ÀíTransat-SQLÓï¾äµ«²¢²»Ö´ÐÐËüÃÇ¡£
--µ±SET NOEXECΪOFFʱ£¬ËùÓеÄÅú´¦ÀíÔÚ±àÒëºóÖ´ÐС£


Ïà¹ØÎĵµ£º

SQL×¢Èë

Ëæ×ÅB/SģʽӦÓÿª·¢µÄ·¢Õ¹£¬Ê¹ÓÃÕâÖÖģʽ±àдӦÓóÌÐòµÄ³ÌÐòÔ±Ò²Ô½À´Ô½¶à¡£µ«ÊÇÓÉÓÚÕâ¸öÐÐÒµµÄÈëÃÅÃż÷²»¸ß£¬³ÌÐòÔ±µÄˮƽ¼°¾­ÑéÒ²²Î²î²»Æ룬Ï൱´óÒ»²¿·Ö³ÌÐòÔ±ÔÚ±àд´úÂëµÄʱºò£¬Ã»ÓжÔÓû§ÊäÈëÊý¾ÝµÄºÏ·¨ÐÔ½øÐÐÅжϣ¬Ê¹Ó¦ÓóÌÐò´æÔÚ°²È«Òþ»¼¡£Óû§¿ÉÒÔÌá½»Ò»¶ÎÊý¾Ý¿â²éѯ´úÂ룬¸ù¾Ý³ÌÐò·µ»ØµÄ½á¹û£¬»ñµÃijЩËûÏëµÃÖªµÄÊ ......

SQL²éѯÓï¾ä´óÈ« T

 --Óï ¾ä                                ¹¦ ÄÜ
1¡¢Êý¾Ý²Ù×÷
Select      --´ÓÊý¾Ý¿â±íÖмìË÷Êý¾ÝÐкÍÁÐ
Insert & ......

Oracle SQLÓï¾ä²Ù×÷Êý×Ö£ºÈ¡Õû¡¢ËÄÉáÎåÈë¼°¸ñʽ»¯

 http://cheneyph.javaeye.com/blog/453492
ÓÃoracle sql¶ÔÊý×Ö½øÐвÙ×÷: È¡ÉÏÈ¡Õû¡¢ÏòÏÂÈ¡Õû¡¢±£ÁôNλСÊý¡¢ËÄÉáÎåÈë¡¢Êý×Ö¸ñʽ»¯
È¡Õû£¨ÏòÏÂÈ¡Õû£©£º 
select floor(5.534) from dual;
select trunc(5.534) from dual;
ÉÏÃæÁ½ÖÖÓ÷¨¶¼¿ÉÒÔ¶ÔÊý×Ö5.534ÏòÏÂÈ¡Õû£¬½á¹ûΪ5.
Èç¹ûÒªÏòÉÏÈ¡Õû £¬µÃµ½½á¹ûÎ ......

sql ³£ÓòÙ×÷Óï¾äÊÕ¼¯

Ò»
    SQLÖظ´¼Ç¼²éѯ£¨×ª×Ôhttp://blog.csdn.net/RainyLin/archive/2009/02/17/3901956.aspx£©
 SQLÖظ´¼Ç¼²éѯ
1¡¢²éÕÒ±íÖжàÓàµÄÖظ´¼Ç¼£¬Öظ´¼Ç¼ÊǸù¾Ýµ¥¸ö×ֶΣ¨peopleId£©À´ÅжÏ
select * from people
where peopleId in (select   peopleId from   people group ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ