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

²âÊÔMSSQLÖÐSQLÓï¾äÖ´Ðл¨·ÑµÄʱ¼ä

selectÓï¾äÇ°¼Ó£º
declare @d datetime
set @d=getdate()
²¢ÔÚselectÓï¾äºó¼Ó£º
select [Óï¾äÖ´Ðл¨·Ñʱ¼ä(ºÁÃë)]=datediff(ms,@d,getdate())
ת×Ô£º¶¯Ì¬ÍøÖÆ×÷Ö¸ÄÏ www.knowsky.com
ÕâÊǼòÒ׵IJ鿴ִÐÐʱ¼äµÄ·½·¨¡£
===========================================£¨Ò»ÏÂÄÚÈÝת×Ô£º£Ã£Ó£Ä£Î£©
MSSQL ServerÖÐͨ¹ý²é¿´SQLÓï¾äÖ´ÐÐËùÓõÄʱ¼ä£¬À´ºâÁ¿SQLÓï¾äµÄÐÔÄÜ¡£
set    statistics    profile    on
set    statistics    io    on
set    statistics    time    on
go
ÄãÖ´ÐеÄSQLÓï¾ä
go
set    statistics    profile    off
set    statistics    io    off
set    statistics    time    off
Ö´ÐÐÍêºóµãÏûÏ¢¼´¿É¡£
²¹³ä˵Ã÷£º
set    statistics    io ¼ì²é²éѯËù²úÉúµÄ¶ÁºÍд
set    statistics    time ¼ì²é²éѯµÄÔËÐÐʱ¼ä
µ±ÔËÐÐÒ»sqlÓï¾ä£¬ÔÚÏûÏ¢ÖлáÏÔʾÈ磺
SQL Server ·ÖÎöºÍ±àÒëʱ¼ä:
CPU ʱ¼ä = 0 ºÁÃ룬ռÓÃʱ¼ä = 10 ºÁÃë¡£
SQL Server ·ÖÎöºÍ±àÒëʱ¼ä:
CPU ʱ¼ä = 0 ºÁÃ룬ռÓÃʱ¼ä = 1 ºÁÃë¡£
(0 ÐÐÊÜÓ°Ïì)
±í ‘t_login_session’¡£É¨Ãè¼ÆÊý 1£¬Âß¼­¶ÁÈ¡ 2 ´Î£¬ÎïÀí¶ÁÈ¡ 0 ´Î£¬Ô¤¶Á 0 ´Î£¬lob Âß¼­¶ÁÈ¡ 0 ´Î£¬lob ÎïÀí¶ÁÈ¡ 0 ´Î£¬lob Ô¤¶Á 0 ´Î¡£
(3 ÐÐÊÜÓ°Ïì)
SQL Server Ö´ÐÐʱ¼ä:
CPU ʱ¼ä = 0 ºÁÃ룬ռÓÃʱ¼ä = 11 ºÁÃë¡£
SQL Server ·ÖÎöºÍ±àÒëʱ¼ä:
CPU ʱ¼ä = 0 ºÁÃ룬ռÓÃʱ¼ä = 1 ºÁÃë¡£
SQL Server Ö´ÐÐʱ¼ä:
CPU ʱ¼ä = 0 ºÁÃ룬ռÓÃʱ¼ä = 1 ºÁÃë¡£
SQL Server Ö´ÐÐʱ¼ä:
CPU ʱ¼ä = 0 ºÁÃ룬ռÓÃʱ¼ä = 1 ºÁÃë¡£
±í ‘t_login_session’¡£É¨Ãè¼ÆÊý 1£¬Âß¼­¶ÁÈ¡ 2 ´Î£¬ÎïÀí¶ÁÈ¡ 0 ´Î£¬Ô¤¶Á 0 ´Î£¬lob Âß¼­¶ÁÈ¡ 0 ´Î£¬lob ÎïÀí¶ÁÈ¡ 0 ´Î£¬lob Ô¤¶Á 0 ´Î¡£
Õâ¸öɨÃèͳ¼Æ¸æËßÎÒÃÇɨÃèÖ´ÐеÄÊýÁ¿£¬Âß¼­¶ÁÏÔʾµÄÊÇ´Ó»º´æÖжÁ³öÀ´µÄÒ³ÃæµÄÊýÁ¿£¬ÎïÀí¶ÁÏÔʾµÄÊÇ´Ó´ÅÅÌÖжÁµÄÒ³ÃæµÄÊýÁ¿£¬Ô¤¶ÁÏÔʾÁË·ÅÖÃÔÚ»º´æÖÐÓÃÓÚ½«À´¶Á²Ù×÷µÄÒ³ÃæÊýÁ¿¡£
ͨ¹ý¿´ÕâЩÐÅÏ¢ÎÒÃÇÄܵõ½Ð©Ê²Ã´ÄØ£¿
¡ôÕâ¸ö²éѯûÓÐɨÃèÕû¸ö±


Ïà¹ØÎĵµ£º

SQL Server´æ´¢¹ý³ÌÈëÃÅ°¸ÀýÏê½â

ÎÊÌâÌá³ö
¡¡¡¡ÎÒʹÓùý¼¸´ÎSQL Server£¬µ«ËùÓÐÓëÊý¾Ý¿âµÄ½»»¥¶¼ÊÇͨ¹ýÓ¦ÓóÌÐòµÄ±àÂëÀ´ÊµÏֵġ£ÎÒ²»Öªµ½ÔÚÄÄÀïʹÓô洢¹ý³Ì£¬Ò²²»Á˽âʵÏÖ´æ´¢¹ý³ÌÐèÒª×öÄÄЩ¹¤×÷¡£Ï£ÍûÄÜÏêϸ˵Ã÷¡£
¡¡¡¡×¨¼Ò´ðÒÉ
¡¡¡¡´æ´¢¹ý³ÌÊÇ´æ´¢ÓÚÊý¾Ý¿âÖеÄÒ»×éT-SQLÓï¾ä¡£ÓÐÁË´æ´¢¹ý³ÌÖ®ºó£¬ÓëÊý¾Ý¿âµÄ½»»¥¾ÍûÓбØÒªÔÚ³ÌÐòÖÐдһ¶ÑµÄSQLÓï¾ä£¬¶ ......

SQL Server 2008 ¶¨Ê±×÷Òµ

--SQL Server 2008 ¶¨Ê±×÷ÒµµÄÖƶ¨
--1.´ò¿ª¡¾SQL Server Management Studio¡¿£¬ÔÚ¡¾¶ÔÏó×ÊÔ´¹ÜÀíÆ÷¡¿ÁбíÖÐÑ¡Ôñ¡¾SQL Server ´úÀí¡¿£»
--2.Êó±êÓÒ»÷¡¾SQL Server ´úÀí¡¿£¬Ñ¡Ôñ¡¾Æô¶¯(S)¡¿£¬ÈçÒÑÆô¶¯£¬¿ÉÒÔÊ¡ÂԴ˲½Ö裻
--3.Õ¹¿ª¡¾SQL Server ´úÀí¡¿ÁÐ±í£¬ÓÒ»÷¡¾×÷Òµ¡¿-->¡¾Ð½¨×÷Òµ¡¿£»
--3.1  ÔÚ¡¾³£¹æ¡¿Ñ¡Ïî ......

SQL string to date time

ÔÚSQL serverÖо­³£»áת»»stringµ½datetimeÀàÐÍ£¬×î³£Óõĺ¯Êý¾ÍÊÇConvert¡£ÄÇô¶ÔConvertÕâ¸öº¯Êý£¬²»µÃ²»ÏêϸµÄÑо¿Ò»Ï¡£ConvertÕâ¸öº¯ÊýµÄ¹¦ÄܺÜÇ¿´ó£¬¸ñʽÓֺܼòµ¥CONVERT ( data_type [ ( length ) ] , expression [ , style ] )¡£µ¥¾Í½«stringµ½datetimeÀàÐ͵Äת»»¾ÍÓкܶàÑùʽ¡£Èç: Convert(datetime, expression), ......

Oracle SQLÓï¾äÓÅ»¯·ÖÎö

¡¡²Ù×÷·ûÓÅ»¯
¡¡¡¡IN ²Ù×÷·û
¡¡¡¡ÓÃINд³öÀ´µÄSQLµÄÓŵãÊDZȽÏÈÝÒ×д¼°ÇåÎúÒ׶®£¬Õâ±È½ÏÊʺÏÏÖ´úÈí¼þ¿ª·¢µÄ·ç¸ñ¡£
¡¡¡¡µ«ÊÇÓÃINµÄSQLÐÔÄÜ×ÜÊDZȽϵ͵ģ¬´ÓORACLEÖ´ÐеIJ½ÖèÀ´·ÖÎöÓÃINµÄSQLÓë²»ÓÃINµÄSQLÓÐÒÔÏÂÇø±ð£º
¡¡¡¡ORACLEÊÔͼ½«Æäת»»³É¶à¸ö±íµÄÁ¬½Ó£¬Èç¹ûת»»²»³É¹¦ÔòÏÈÖ´ÐÐINÀïÃæµÄ×Ó²éѯ£¬ÔÙ²éѯÍâ²ãµÄ±í¼Ç¼£ ......

SQL »ù±¾²Ù×÷ ɾ³ý ÐÞ¸Ä Ë¢ÐÂ

SQL³£ÓÃÃüÁîʹÓ÷½·¨£º    
   
  (1)   Êý¾Ý¼Ç¼ɸѡ£º    
   
  sql="select   *   from   Êý¾Ý±í   where   ×Ö¶ÎÃû=×Ö¶ÎÖµ   order   by   ×Ö¶ÎÃû   [desc]"    
   
  sq ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ