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

sql DATEPART£¨£©º¯Êý

cdateÊÇdatetimeÀàÐ͵Ä×Ö¶Î
ͳ¼ÆÒ»ÄêµÄÈçÏÂ
 select datepart(yy,cdate) as 'Ô·Ý',sum(cmoney) from consumption group by datepart(yy,cdate)
ͳ¼ÆÒ»ÔµÄÈçÏÂ
 select datepart(mm,cdate) as 'Ô·Ý',sum(cmoney) from consumption where datepart(yy,cdate)=2009 group by datepart(mm,cdate)
ͳ¼ÆÒ»ÖܵÄÈçÏÂ
select DATEPART(wk,cdate) as 'ÖÜ', sum(cmoney) from consumption group by DATEPART(wk,cdate)
ͳ¼ÆÒ»ÌìµÄÈçÏÂ
select DATEPART(dd,cdate) as 'ºÅ', sum(cmoney) from consumption  where datepart(mm,cdate)=6  group by DATEPART(dd,cdate)
ÒÔÉÏÓõ½µÄ¾ÍÊÇ“DATEPART£¨£©”º¯Êý¡£º¯ÊýDATEPART£¨£©µÄ²ÎÊýÊÇÁ½¸ö±äÁ¿¡£µÚÒ»¸ö±äÁ¿Ö¸¶¨Òª³éÈ¡ÈÕÆÚµÄÄÄÒ»²¿·Ö£»µÚ¶þ¸ö±äÁ¿ÊÇʵ¼ÊµÄÊý¾Ý¡£
ÈÕÆÚµÄ¸÷²¿·Ö¼°Æä¼òд
ÈÕÆÚ²¿·Ö           ¼òд               Öµ
year                yy                1753--9999
quarter             qq                1--4
month               mm                1--12
day of year         dy                1--366
day                 dd                1--31
week                wk              &n


Ïà¹ØÎĵµ£º

SQLÏÂÈÕÆÚº¯ÊýʹÓÃ

ÕâÁ½Ììдһ¸öºÍͳ¼ÆÊý¾ÝÓйصĴ洢¹ý³Ì£¬ÀïÃæÒªÀûÓÃÈÕÆÚ½øÐÐһЩ¼ÆËãºÍÅжϣ¬Ò²×ÔȻҪÀûÓÃSQLµÄһЩÈÕÆÚÏà¹ØµÄº¯Êý¡£ÕâÀïÂÔ¼Çһϣ¬µ±ÊǸ´Ï°Ò»ÏÂSQL¡£
ÀûÓÃSQL½Å±¾ÄÚÖõöº¯Êý£¬ÎÒÃÇÄÜÁé»îµÄ¶ÔÈÕÆÚ½øÐмÆËãºÍ±È½Ï¡£³£Óõöº¯Êý£ºGETDATE(),DATEDIFF(),DATEADD()
GETDATE() µ±È»¹ËÃû˼Ò壬µÃµ½µ±Ç°µÄÈÕÆÚ£¬·µ»ØÀàÐÍÊ ......

¼¸Ìõ³£¼ûµÄÊý¾Ý¿â·ÖÒ³ SQL Óï¾ä

 ÎÒÃÇÔÚ±àдMISϵͳºÍWebÓ¦ÓóÌÐòµÈϵͳʱ£¬¶¼Éæ¼°µ½ÓëÊý¾Ý¿âµÄ½»»¥£¬Èç¹ûÊý¾Ý¿âÖÐÊý¾ÝÁ¿ºÜ´óµÄ»°£¬Ò»´Î¼ìË÷ËùÓеļǼ£¬»áÕ¼ÓÃϵͳºÜ´óµÄ×ÊÔ´£¬Òò´ËÎÒÃdz£³£²ÉÓã¬ÐèÒª¶àÉÙÊý¾Ý¾ÍÖ»´ÓÊý¾Ý¿âÖÐÈ¡¶àÉÙÌõ¼Ç¼£¬¼´²ÉÓ÷ÖÒ³Óï¾ä¡£¸ù¾Ý×Ô¼ºÊ¹ÓùýµÄÄÚÈÝ£¬°Ñ³£¼ûÊý¾Ý¿âSQL Server,OracleºÍMySQLµÄ·ÖÒ³Óï¾ä£¬´ÓÊý¾Ý¿â±íÖÐµÄµÚ ......

SQL 2005µÄ±¸·ÝÎļþµ¼Èëµ½SQL 2000

參¿¼: http://brightsky006.blog.163.com/blog/static/22583668200962195059485/
°ÑSQL 2005µÄ±¸·ÝÎļþµ¼Èëµ½SQL 2000
ѧϰÕ䲨   2009-07-21 09:50   ÔĶÁ616   ÆÀÂÛ0  
×ֺţº ´ó´ó  ÖÐÖР СС
µçÄÔÉϰ²×°ÁËSQL Server 2005£¬ÏÖÔÚÏë»»»ØSQL2000À´£¬ ......

SQLÊý¾Ý¿â¿ª·¢ÖеÄһЩ¾«µä´úÂë

ÕýÔÚ¼ÓÔØÊý¾Ý...
¡¡¡¡1.°´ÐÕÊϱʻ­ÅÅÐò: select * from TableName Order By CustomerName Collate Chinese_PRC_Stroke_ci_as
¡¡¡¡2.Êý¾Ý¿â¼ÓÃÜ: select encrypt(’ԭʼÃÜÂë’) select pwdencrypt(’ԭʼÃÜÂë’) select pwdcompare(’ԭʼÃÜÂë’,’¼ÓÃܺóÃÜÂë’) = 1--Ïàͬ£»·ñÔ ......

¶¯Ì¬´´½¨Sql ServerÓû§¼°ÆäȨÏÞ

Ò»¡¢ÈçºÎ¶¯Ì¬´´½¨Óû§
1.ʹÓô洢¹ý³Ì
sp_addlogin (Transact-SQL)
´´½¨Ð嵀 SQL Server µÇ¼£¬¸ÃµÇ¼ÔÊÐíÓû§Ê¹Óà SQL Server Éí·ÝÑéÖ¤Á¬½Óµ½ SQL Server ʵÀý¡£
ÖØÒªÌáʾ£º
ºóÐø°æ±¾µÄ Microsoft SQL Server ½«É¾³ý¸Ã¹¦ÄÜ¡£Çë±ÜÃâÔÚеĿª·¢¹¤×÷ÖÐʹÓøù¦ÄÜ£¬²¢×ÅÊÖÐ޸ĵ±Ç°»¹ÔÚʹÓøù¦ÄܵÄÓ¦ÓóÌÐò¡£Çë¸ÄÓà CREAT ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ