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

SQLº¯Êý(ÕûÀíµÄÎĵµ¹²ÏíÒ»ÏÂ)

sql2000º¯Êý´óÈ«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 y Ò»ÄêµÄÈÕÊý,Ò»ÄêÖеĵڼ¸ÈÕ 1-366
Day Dd d ÈÕ£¬1-31
Weekday Dw w Ò»ÖܵÄÈÕÊý£¬Ò»ÖÜÖеĵڼ¸ÈÕ 1-7
Week Wk ww ÖÜ£¬Ò»ÄêÖеĵڼ¸ÖÜ 0 ~ 51
Hour Hh h ʱ0 ~ 23
Minute Mi n ·ÖÖÓ0 ~ 59
Second Ss s Ãë 0 ~ 59
Millisecond Ms - ºÁÃë 0 ~ 999
access ºÍ asp ÖÐÓÃdate()ºÍnow()È¡µÃϵͳÈÕÆÚʱ¼ä£»ÆäÖÐDateDiff,DateAdd,DatePartҲͬÊÇÄÜÓÃÓÚAccessºÍaspÖУ¬ÕâЩº¯ÊýµÄÓ÷¨Ò²ÀàËÆ
¾ÙÀý£º
1.GetDate() ÓÃÓÚsql server :select GetDate()
2.DateDiff('s','2005-07-20','2005-7-25 22:56:32')·µ»ØֵΪ 514592 Ãë
DateDiff('d','2005-07-20','2005-7-25 22:56:32')·µ»ØֵΪ 5 Ìì
3.DatePart('w','2005-


Ïà¹ØÎĵµ£º

SQLº¯ÊýÖ®ÈÕÆÚºÍʱ¼äº¯Êý

MySQLÖÐÎIJο¼ÊÖ²á- 7 MySQL ÓïÑԲο¼
<!--
body { font-size: 9pt; }
a:hover{color:red;}
a.t1:visited{color:red;}
-->
¶ÔÓÚÿ¸öÀàÐÍÓµÓеÄÖµ·¶Î§ÒÔ¼°²¢ÇÒÖ¸¶¨ÈÕÆÚºÎʱ¼äÖµµÄÓÐЧ¸ñʽµÄÃèÊö¼û7.3.6 ÈÕÆÚºÍʱ¼äÀàÐÍ
¡£
ÕâÀïÊÇÒ»¸öʹÓÃÈÕÆÚº¯ÊýµÄÀý×Ó¡£ÏÂÃæµÄ²éѯѡÔñÁËËùÓмǼ£¬Æädate_col
µÄÖµÊÇÔÚ×îº ......

SQL SERVER ´æ´¢¹ý³Ì¼ÓÃܺͽâÃÜ

create PROCEDURE sp_decrypt(@objectname varchar(50))
AS
begin
set nocount on
--CSDN£ºj9988 copyright:2004.07.15
--V3.2
--Æƽâ×Ö½Ú²»ÊÜÏÞÖÆ£¬ÊÊÓÃÓÚSQLSERVER2000´æ´¢¹ý³Ì£¬º¯Êý£¬ÊÓͼ£¬´¥·¢Æ÷
--ÐÞÕýÉÏÒ»°æ"ÊÓͼ´¥·¢Æ÷"²»ÄÜÕýÈ·½âÃÜ´íÎó
--·¢ÏÖÓÐ´í£¬ÇëE_MAIL£ºCSDNj9988@tom.com
begin tran ......

SQL exists ºÍin

in ºÍ existsÆäʵͦºÃÇø±ðµÄ.ÇÒ¿´Ï±߻ù±¾¸ÅÄî¡£
in ÊÇÒ»¸ö¼¯ºÏÔËËã·û.
a in {a,c,d,s,d....}
Õâ¸öÔËËãÖÐ,Ç°ÃæÊÇÒ»¸öÔªËØ,ºóÃæÊÇÒ»¸ö¼¯ºÏ,¼¯ºÏÖеÄÔªËØÀàÐÍÊǺÍÇ°ÃæµÄÔªËØÒ»ÑùµÄ¡£ÊµÏֵĶԼ¯ºÏÖеÄÔªËؽøÐбéÀú£¬ÒÔÈ·¶¨¸ø¶¨µÄÔªËØaÊÇ·ñÓë×Ó²éѯ»òÁбíÖеÄÖµÏàÆ¥Åä¡£
in ÔËËãÓÃÔÚsqlÓï¾äÖÐ,ËüºóÃæ´øµÄselect Ò»¶¨ÊÇÑ¡Ò»¸ ......

Ìá¸ßSQLЧÂʵķ½°¸

--oracleÓÅ»¯slqÓï¾ä
    £¨1£©Ñ¡Ôñ×îÓÐЧÂʵıíÃû˳Ðò(Ö»ÔÚ»ùÓÚ¹æÔòµÄÓÅ»¯Æ÷ÖÐÓÐЧ)£º
¡¡¡¡OracleµÄ½âÎöÆ÷°´ÕÕ´ÓÓÒµ½×óµÄ˳Ðò´¦Àífrom×Ó¾äÖеıíÃû£¬from×Ó¾äÖÐдÔÚ×îºóµÄ±í(»ù´¡±í driving table)½«±»×îÏÈ´¦Àí£¬ÔÚfrom×Ó¾äÖаüº¬¶à¸ö±íµÄÇé¿öÏÂ,Äú±ØÐëÑ¡Ôñ¼Ç¼ÌõÊý×îÉٵıí×÷Ϊ»ù´¡±í¡£¼ÙÈçÓÐ3¸öÒÔÉ쵀 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ