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

Sql serverÖÐ DateAdd¡¢DateDiffÓ÷¨

 Õâ¸öº¯ÊýDateAdd(month,2,WriteTime)£º
ÈÕÆÚ²¿·ÖËõд Year yy, yyyy quarter qq, q Month mm, m dayofyear dy, y Day dd, d Week wk, ww Hour hh minute mi, n second ss, s millisecond ms
¡¡¡¡Õâ¸ö±í×㹻˵Ã÷ÎÊÌâÁË°É,´Óyearµ½millisecond¶¼¿ÉÒÔ´¦Àí£¬¹»·½±ãÁË°É.
DATEDIFF º¯Êý [ÈÕÆÚºÍʱ¼ä]
--------------------------------------------------------------------------------
¹¦ÄÜ
·µ»ØÁ½¸öÈÕÆÚÖ®¼äµÄ¼ä¸ô¡£
Óï·¨
DATEDIFF ( date-part, date-expression-1, date-expression-2 )
date-part :
year | quarter | month | week | day | hour | minute | second | millisecond
²ÎÊý
date-part    Ö¸¶¨Òª²âÁ¿Æä¼ä¸ôµÄÈÕÆÚ²¿·Ö¡£
ÓйØÈÕÆÚ²¿·ÖµÄÏêϸÐÅÏ¢£¬Çë²Î¼ûÈÕÆÚ²¿·Ö¡£
date-expression-1    ijһ¼ä¸ôµÄÆðʼÈÕÆÚ¡£´Ó date-expression-2 ÖмõÈ¥¸ÃÖµ£¬·µ»ØÁ½¸ö²ÎÊýÖ®¼ä date-parts µÄÌìÊý¡£
date-expression-2    ijһ¼ä¸ôµÄ½áÊøÈÕÆÚ¡£´Ó¸ÃÖµÖмõÈ¥ Date-expression-1£¬·µ»ØÁ½¸ö²ÎÊýÖ®¼ä date-parts µÄÌìÊý¡£
Ó÷¨
´Ëº¯Êý¼ÆËãÁ½¸öÖ¸¶¨ÈÕÆÚÖ®¼äÈÕÆÚ²¿·ÖµÄÊýÄ¿¡£½á¹ûΪÈÕÆÚ²¿·ÖÖеÈÓÚ£¨date2 - date1£©µÄÓзûºÅµÄÕûÊýÖµ¡£
µ±½á¹û²»ÊÇÈÕÆÚ²¿·ÖµÄżÊý±¶Ê±£¬DATEDIFF ½«±»½Ø¶Ï¶ø²»ÊDZ»ÉáÈë¡£
µ±Ê¹Óà day ×÷ΪÈÕÆÚ²¿·Öʱ£¬DATEDIFF ·µ»ØÁ½¸öÖ¸¶¨µÄʱ¼äÖ®¼ä£¨°üÀ¨µÚ¶þ¸öÈÕÆÚµ«²»°üÀ¨µÚÒ»¸öÈÕÆÚ£©µÄÎçÒ¹Êý¡£
µ±Ê¹Óà month ×÷ΪÈÕÆÚ²¿·Öʱ£¬DATEDIFF ·µ»ØÁ½¸öÈÕÆÚÖ®¼ä£¨°üÀ¨µÚ¶þ¸öÈÕÆÚµ«²»°üÀ¨µÚÒ»¸öÈÕÆÚ£©³öÏÖµÄÔµĵÚÒ»ÌìµÄÊýÄ¿¡£
µ±Ê¹Óà week ×÷ΪÈÕÆÚ²¿·Öʱ£¬DATEDIFF ·µ»ØÁ½¸öÈÕÆÚ£¨°üÀ¨µÚ¶þ¸öÈÕÆÚµ«²»°üÀ¨µÚÒ»¸öÈÕÆÚ£©Ö®¼äÐÇÆÚÈÕµÄÊýÄ¿¡£
¶ÔÓÚ¸üСµÄʱ¼äµ¥Î»´æÔÚÒç³öÖµ£º
milliseconds    24 Ìì
seconds    68 Äê
minutes    4083 Äê
others    ûÓÐÒç³öÏÞÖÆ
Èç¹û³¬³öÕâЩÏÞÖÆ£¬´Ëº¯Êý½«·µ»ØÒç³ö´íÎó¡£
±ê×¼ºÍ¼æÈÝÐÔ
SQL/92    Transact-SQL À©Õ¹¡£
SQL/99    Transact-SQL À©Õ¹¡£
Sybase    Óë Adaptive Server Enterprise ¼æÈÝ¡£
ʾÀý
ÏÂÃæµÄÓï¾ä·µ»Ø 1£º
SELECT datediff( hour, '4:00AM', '5:50AM' )ÏÂÃæµÄÓï¾ä·µ»Ø 102£º
SELECT datediff( month, '1987/05/02', '1995/11/15' )ÏÂÃæµÄÓï¾ä·µ»Ø 0£º
SELECT datediff( day, '00


Ïà¹ØÎĵµ£º

SQL2005ºÍ(Excel |access)Ö®¼äµÄÊý¾Ýµ¼Èëµ¼³ö


Sql´úÂë
--²ÉÓÃSQLÓï¾äʵÏÖsql2005ºÍExcel Êý¾ÝÖ®¼äµÄÊý¾Ýµ¼Èëµ¼³ö£¬ÔÚÍøÉÏÕÒÀ´Ò»--Ï£¬ÊµÏÖ·½·¨ÊÇÕâÑùµÄ£º    
  
  
--Excel---->SQL2005  µ¼È룺    
  
  
select * into useinfo from O ......

JAVAÁ¬½ÓACCESS£¬SQL Server,MySQL,Oracle

import java.sql.*;
/*
* JAVAÁ¬½ÓACCESS£¬SQL Server,MySQL,OracleÊý¾Ý¿â
*
* */
public class JDBC {
  
public static void main(String[] args)throws Exception {
  
   Connection conn=null;
  
       //====Á¬½ÓACCESSÊý¾Ý¿â ......

[ÊÕ£] ÓÃsqlite Ö´Ðбê×¼ sql Óï·¨

http://www.umgr.com/blog/PostView.aspx?bpId=36294
 1. Ö´ÐÐsqlÓï¾ä
int sqlite3_exec(sqlite3*£¬ const char *sql£¬ sqlite3_callbacksql Óï·¨
£¬ void *£¬  char **errmsg );
Õâ¾ÍÊÇÖ´ÐÐÒ»Ìõ sql Óï¾äµÄº¯Êý¡£
µÚ1¸ö²ÎÊý²»ÔÙ˵ÁË£¬ÊÇÇ°Ãæopenº¯ÊýµÃµ½µÄÖ¸Õ롣˵ÁËÊǹؼüÊý¾Ý½á¹¹¡£
µÚ2¸ö²ÎÊýconst char ......

ASP.NET·ÀÖ¹SQL×¢È뺯Êý

ASP.NET·ÀÖ¹SQL×¢È뺯Êý:
using System;
using System.Text.RegularExpressions;
using System.Web;
namespace FSqlKeyWord
......{
    /**//**//**//// <summary>
    /// SqlKey µÄժҪ˵Ã÷¡£
    /// </summary>
    public class S ......

¸ßÊÖÏê½âSQLÐÔÄÜÓÅ»¯Ê®Ìõ¾­Ñé

1.²éѯµÄÄ£ºýÆ¥Åä
¾¡Á¿±ÜÃâÔÚÒ»¸ö¸´ÔÓ²éѯÀïÃæʹÓà LIKE '%parm1%'—— ºìÉ«±êʶλÖõİٷֺŻᵼÖÂÏà¹ØÁеÄË÷ÒýÎÞ·¨Ê¹Óã¬×îºÃ²»ÒªÓÃ.
½â¾ö°ì·¨:
ÆäʵֻÐèÒª¶Ô¸Ã½Å±¾ÂÔ×ö¸Ä½ø£¬²éѯËٶȱã»áÌá¸ß½ü°Ù±¶¡£¸Ä½ø·½·¨ÈçÏ£º
a¡¢ÐÞ¸Äǰ̨³ÌÐò——°Ñ²éѯÌõ¼þµÄ¹©Ó¦ÉÌÃû³ÆÒ»À¸ÓÉÔ­À´µÄÎı¾ÊäÈë¸ÄΪÏÂÀ­Áб ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ