SQLÓÃDataDiff²éѯµÄ¹ÖÏÖÏó¶øÒý·¢µÄ˼¿¼(2)
ÔÚÄÔ×ÓÀïÀÏÊǼǵõ±³õдSQLµÄʱºò£¬×ÜÊÇÓÐÈËÌáÐѶÔÓÚÖ÷¼üµÄÌõ¼þҪдÔÚÇ°Ã棬ÖÁÓÚΪʲôÏÖÔÚ×ÜÊǼDz»Çå³þÁË¡£µ«ÊÇSQLÖÐwhere Ìõ¼þµÄÖ´ÐÐ˳Ðò¸úÖ÷¼üÒÔ¼°Ë÷ÒýÓкܴóµÄ¹Øϵ¡£
°ÑÉÏƬÖеıía ¼ÓÉÏÖ÷¼ü£º
alter table
add constraint pk_a_id primary key (id)
È»ºóÔÚÔËÐÐÉÏƪÖгö´íµÄÀý¾ä:
select * from a where id in (1,3) and datediff(day, convert(datetime,val),getdate()) < 0
¾¹È»Ã»ÓдíÎ󣬷µ»ØÁËid=1µÄ¼Ç¼¡£¿´À´£¬Èç¹û±íÖÐÓÐÖ÷¼üµÄ»°£¬Ö÷¼ü»á±»ÓÅÏÈÖ´Ðеġ£ËùÒÔ´Ëʱid =2µÄ¼Ç¼¸ù±¾¾Í²»ÔÚ¿¼ÂÇ·¶Î§Ö®ÄÚ¡£
¼ÙÉèÎÒÃDz»¼ÓÖ÷¼ü£¬¶øÊǼÓÉÏÒ»¸öuniqueµÄindex£º
alter table a
drop constraint pk_a_id
create unique index u_a_id on a(id)
È»ºóÔÙÔËÐÐÉÏÃæµÄ¾ä×Ó£º
select * from a where id in (1,3) and datediff(day, convert(datetime,val),getdate()) < 0
³öÏÖÁË´íÎó£º
Msg 241, Level 16, State 1, Line 1
Conversion failed when converting datetime from character string.
¿É¼ûindex, ²¢²»Äܸıäwhere Ìõ¼þµÄÖ´ÐÐ˳Ðò£¬µ«ÊÇÖ÷¼üÊÇ¿ÉÒԵġ£
Ïà¹ØÎĵµ£º
Ò»¡¢SQL SERVER ºÍACCESSµÄÊý¾Ýµ¼Èëµ¼³ö
³£¹æµÄÊý¾Ýµ¼Èëµ¼³ö£º
ʹÓÃDTSÏòµ¼Ç¨ÒÆÄãµÄAccessÊý¾Ýµ½SQL Server£¬Äã¿ÉÒÔʹÓÃÕâЩ²½Öè:
¡¡¡¡¡ð1ÔÚSQL SERVERÆóÒµ¹ÜÀíÆ÷ÖеÄTools£¨¹¤¾ß£©²Ëµ¥ÉÏ£¬Ñ¡ÔñData Transformation
¡¡¡¡¡ð2Services£¨Êý¾Ýת»»·þÎñ£©£¬È»ºóÑ¡Ôñ czdImport Dat ......
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 ......
1.Ñ¡Ôñ×îÓÐЧÂʵıíÃû˳Ðò(Ö»ÔÚ»ùÓÚ¹æÔòµÄÓÅ»¯Æ÷ÖÐÓÐЧ)¡¡¡¡
¡¡¡¡ SQLSERVERµÄ½âÎöÆ÷°´ÕÕ´ÓÓÒµ½×óµÄ˳Ðò´¦Àífrom×Ó¾äÖеıíÃû£¬Òò´Ëfrom×Ó¾äÖÐдÔÚ×îºóµÄ±í£¨»ù´¡±ídriving table£©½«±»×îÏÈ´¦Àí£¬ÔÚfrom×Ó¾äÖаüº¬¶à¸ö±íµÄÇé¿öÏ£¬±ØÐëÑ¡Ôñ¼Ç¼ÌõÊý×îÉٵıí×÷Ϊ»ù´¡±í£¬µ±SQLSERVER´¦Àí¶à¸ö±íʱ£¬»áÔËÓÃÅÅÐò¼°ºÏ²¢µÄ·½Ê½Á ......
--ÐÐÁл¥×ª
/******************************************************************************************************************************************************
ÒÔѧÉú³É¼¨ÎªÀý×Ó£¬±È½ÏÐÎÏóÒ׶®
ÕûÀíÈË£ºÖйú·ç(Roy)
ÈÕÆÚ:2008.06.06
***************************************************************** ......
ÏëÆðÀ´ÉÏ´ÎÃæÊÔµÄʱºòÄǸöÃæÊÔ¹ÙÎÊÎÒ
“Äã¶ÔÓÅ»¯·½ÃæÁ˽â¶àÉÙ”
“ORACLEÓÅ»¯»¹ÊÇSQLÓÅ»¯”
“SQLÓÅ»¯”
“Õâ¸ö……²»ÖªµÀ´ÓºÎ˵Æð”
“ºÇºÇ£¬ÄÇÎÒÎÊÄãÎÊÌâºÃÁË£¬ÎÊÎʾÍÖªµÀÄã´ó¸ÅʲôˮƽÁË”
“ºÇºÇ£¬ºÃ°É”
……
½á¹ûºÃÏñ ......