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

sql serverÈÕÆÚʱ¼äº¯Êý

Sql ServerÖеÄÈÕÆÚÓëʱ¼äº¯Êý 
1.  µ±Ç°ÏµÍ³ÈÕÆÚ¡¢Ê±¼ä 
    select getdate()  
2. dateadd  ÔÚÏòÖ¸¶¨ÈÕÆÚ¼ÓÉÏÒ»¶Îʱ¼äµÄ»ù´¡ÉÏ£¬·µ»ØеĠdatetime Öµ
   ÀýÈ磺ÏòÈÕÆÚ¼ÓÉÏ2Ìì 
   select dateadd(day,2,'2004-10-15')  --·µ»Ø£º2004-10-17 00:00:00.000
3. datediff ·µ»Ø¿çÁ½¸öÖ¸¶¨ÈÕÆÚµÄÈÕÆÚºÍʱ¼ä±ß½çÊý¡£
   select datediff(day,'2004-09-01','2004-09-18')   --·µ»Ø£º17
4. datepart ·µ»Ø´ú±íÖ¸¶¨ÈÕÆÚµÄÖ¸¶¨ÈÕÆÚ²¿·ÖµÄÕûÊý¡£
  SELECT DATEPART(month, '2004-10-15')  --·µ»Ø 10
5. datename ·µ»Ø´ú±íÖ¸¶¨ÈÕÆÚµÄÖ¸¶¨ÈÕÆÚ²¿·ÖµÄ×Ö·û´®
   SELECT datename(weekday, '2004-10-15')  --·µ»Ø£ºÐÇÆÚÎå
6. day(), month(),year() --¿ÉÒÔÓëdatepart¶ÔÕÕÒ»ÏÂ
select µ±Ç°ÈÕÆÚ=convert(varchar(10),getdate(),120) 
,µ±Ç°Ê±¼ä=convert(varchar(8),getdate(),114) 
select datename(dw,'2004-10-15') 
select ±¾ÄêµÚ¶àÉÙÖÜ=datename(week,'2004-10-15')
      ,½ñÌìÊÇÖܼ¸=datename(weekday,'2004-10-15')
º¯Êý
²ÎÊý/¹¦ÄÜ
GetDate( ) 
·µ»ØϵͳĿǰµÄÈÕÆÚÓëʱ¼ä
DateDiff (interval,date1,date2)
ÒÔinterval Ö¸¶¨µÄ·½Ê½£¬·µ»Ødate2 Óëdate1Á½¸öÈÕÆÚÖ®¼äµÄ²îÖµ date2-date1
DateAdd (interval,number,date)
ÒÔintervalÖ¸¶¨µÄ·½Ê½£¬¼ÓÉÏnumberÖ®ºóµÄÈÕÆÚ
DatePart (interval,date)
·µ»ØÈÕÆÚdateÖУ¬intervalÖ¸¶¨²¿·ÖËù¶ÔÓ¦µÄÕûÊýÖµ
DateName (interval,date)
·µ»ØÈÕÆÚdateÖУ¬intervalÖ¸¶¨²¿·ÖËù¶ÔÓ¦µÄ×Ö·û´®Ãû³Æ
²ÎÊý intervalµÄÉ趨ֵÈçÏ£º
Öµ
Ëõ Ð´£¨Sql Server£©
(Access ºÍ ASP)
˵Ã÷
Year
Yy
yyyy
Äê 1753 ~ 9999
Quarter
Qq
q  
¼¾ 1 ~ 4
Month
Mm
m  
ÔÂ1 ~ 12
Day of year
Dy

Ò»ÄêµÄÈÕÊý,Ò»ÄêÖеĵڼ¸ÈÕ 1-366
Day
Dd
d  
ÈÕ£¬1-31
W


Ïà¹ØÎĵµ£º

SQLÖ®COLLATE ×Ó¾ä ÅÅÐò¹æÔò

COLLATE ÊÇÒ»¸ö×Ӿ䣬¿ÉÓ¦ÓÃÓÚÊý¾Ý¿â¶¨Òå»òÁж¨ÒåÒÔ¶¨ÒåÅÅÐò¹æÔò£¬»òÓ¦ÓÃÓÚ×Ö·û´®±í´ïʽÒÔÓ¦ÓÃÅÅÐò¹æÔòת»»¡£
Óï·¨
COLLATE { <collation_name> | database_default }
<collation_name> :: =
     { Windows_collation_name } | { SQL_collation_name }
²ÎÊý
collation_name
  ......

ÈçºÎ²é¿´SQL Server ²¹¶¡µÄ°æ±¾£¿

 Õâ¸öÌâÄ¿ÌýÆðÀ´Ê®·ÖÞÖ¿Ú£¬Ó¢ÎÄÓ¦¸ÃÕâÑùд“How to find the service pack version installed on SQL Server using”£¬Õâ¸öÎÊÌâÎÒÒ»Ö±ÔÚÕÒ£¬SQL ServerһֱûÓÐÏñÆäËûÈí¼þÒ»Ñù¿ÉÒÔÖ±½Ó²é¿´µ½°æ±¾+²¹¶¡ºÅµÄ·½·¨£¬½ñÌìµ½Ò»¸öÀÏÍâµÄÍøÕ¾ÖÕÓÚÕÒµ½ÁË£º
ÓÐÁ½ÖÖ·½·¨£º
µÚÒ»²½£ºÊ¹ÓÃSQLÓï¾ä²éѯ
select @@version ......

SQL Server2005ËĸöÅÅÐòº¯Êý¼ò½é

ÅÅÃûº¯ÊýÊÇSQL Server2005мӵŦÄÜ¡£ÔÚSQL Server2005ÖÐÓÐÈçÏÂËĸöÅÅÃûº¯Êý£º
1. row_number ×Ô¶¯Éú³ÉÐкÅ,ÐòºÅÓÉorder by ×ֶξö¶¨
2. rank over Filed, ÓÉrank overµÄ×ֶξö¶¨£¬Ãû´Î²»Á¬Ðø£¬ÈçÓÐ3¸ö²¢ÁеÚÒ»Ãû£¬ÔòºóÐøÃû´ÎÖ±½Ó´Ó4¿ªÊ¼
3. dense_rank£¬ºÍrankÏàËÆ£¬Ö»ÊÇÃû´ÎÁ¬Ðø£¬ÈçÓÐ3¸ö²¢ÁеÚÒ»Ãû£ ......

SQL SERVER 2005Ïà¹ØÎÊÌâ

Òѳɹ¦Óë·þÎñÆ÷½¨Á¢Á¬½Ó£¬µ«ÊÇÔڵǼǰµÄÎÕÊÖÆڼ䷢Éú´íÎóµÄ´¦Àí·½·¨
      ÔÚÓÃSQL SERVER Óû§µÇ½SQL SERVER 2005ʱ£¬µ¯³öÒ»¸ö¶Ô»°¿ò£¬Ìáʾ" Òѳɹ¦Óë·þÎñÆ÷½¨Á¢Á¬½Ó£¬µ«ÊÇÔڵǼǰµÄÎÕÊÖÆڼ䷢Éú´íÎó",²éÕÒÁËÒ»ÏÂÔ­Òò£¬Ô­À´ÊÇSQL SERVER 2005ʱ½ûÓÃTCP/IPµÇ½ÁË£¬´ò¿ªSQL SERVER 2005²Ë ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ