½â¾öͬʱÐÞ¸ÄͬһSQL¼Ç¼µÄÎÊÌâ
ÔÚÑ°ÕÒPowerDesignerÏà¹ØÐÅÏ¢µÄʱºòżȻ·¢ÏÖµÄ.ʹÓÃtimestamp
΢ÈíMSDNÄÚÈÝ:
timestamp (Transact-SQL)
¹«¿ªÊý¾Ý¿âÖÐ×Ô¶¯Éú³ÉµÄΨһ¶þ½øÖÆÊý×ÖµÄÊý¾ÝÀàÐÍ¡£timestamp ͨ³£ÓÃ×÷¸ø±íÐмӰ汾´ÁµÄ»úÖÆ¡£ ´æ´¢´óСΪ 8 ¸ö×Ö½Ú¡£ timestamp Êý¾ÝÀàÐÍÖ»ÊǵÝÔöµÄÊý×Ö£¬²»±£ÁôÈÕÆÚ»òʱ¼ä¡£ ÈôÒª¼Ç¼ÈÕÆÚ»òʱ¼ä£¬ÇëʹÓà datetime Êý¾ÝÀàÐÍ¡£
±¸×¢
ÿ¸öÊý¾Ý¿â¶¼ÓÐÒ»¸ö¼ÆÊýÆ÷£¬µ±¶ÔÊý¾Ý¿âÖаüº¬ timestamp ÁеıíÖ´ÐвåÈë»ò¸üвÙ×÷ʱ£¬¸Ã¼ÆÊýÆ÷Öµ¾Í»áÔö¼Ó¡£ ¸Ã¼ÆÊýÆ÷ÊÇÊý¾Ý¿âʱ¼ä´Á¡£ Õâ¿ÉÒÔ¸ú×ÙÊý¾Ý¿âÄÚµÄÏà¶Ôʱ¼ä£¬¶ø²»ÊÇʱÖÓÏà¹ØÁªµÄʵ¼Êʱ¼ä¡£ Ò»¸ö±íÖ»ÄÜÓÐÒ»¸ö timestamp ÁС£ ÿ´ÎÐ޸Ļò²åÈë°üº¬ timestamp ÁеÄÐÐʱ£¬¾Í»áÔÚ timestamp ÁÐÖвåÈëÔöÁ¿Êý¾Ý¿âʱ¼ä´ÁÖµ¡£ ÕâÒ»ÊôÐÔʹ timestamp Áв»ÊʺÏ×÷Ϊ¼üʹÓã¬ÓÈÆäÊDz»ÄÜ×÷ΪÖ÷¼üʹÓᣠ¶ÔÐеÄÈκθüж¼»á¸ü¸Ä timestamp Öµ£¬´Ó¶ø¸ü¸Ä¼üÖµ¡£ Èç¹û¸ÃÁÐÊôÓÚÖ÷¼ü£¬ÄÇô¾ÉµÄ¼üÖµ½«ÎÞЧ£¬½ø¶øÒýÓøþÉÖµµÄÍâ¼üÒ²½«²»ÔÙÓÐЧ¡£ Èç¹û¸Ã±íÔÚ¶¯Ì¬ÓαêÖÐÒýÓã¬ÔòËùÓиüоù»á¸ü¸ÄÓαêÖÐÐеÄλÖᣠÈç¹û¸ÃÁÐÊôÓÚË÷Òý¼ü£¬Ôò¶ÔÊý¾ÝÐеÄËùÓиüл¹½«µ¼ÖÂË÷Òý¸üС£
ʹÓÃijһÐÐÖÐµÄ timestamp ÁпÉÒÔºÜÈÝÒ×µØÈ·¶¨¸ÃÐÐÖеÄÈκÎÖµ×ÔÉϴζÁÈ¡ÒÔºóÊÇ·ñ·¢ÉúÁ˸ü¸Ä¡£ Èç¹û¶ÔÐнøÐÐÁ˸ü¸Ä£¬¾Í»á¸üиÃʱ¼ä´ÁÖµ¡£ Èç¹ûûÓжÔÐнøÐиü¸Ä£¬Ôò¸Ãʱ¼ä´ÁÖµ½«ÓëÒÔÇ°¶ÁÈ¡¸ÃÐÐʱµÄʱ¼ä´ÁÖµÒ»Ö¡£ ÈôÒª·µ»ØÊý¾Ý¿âµÄµ±Ç°Ê±¼ä´ÁÖµ£¬ÇëʹÓà http://msdn.microsoft.com/zh-cn/library/ms187366.aspx¡£
Transact-SQL timestamp Êý¾ÝÀàÐͲ»Í¬ÓÚÔÚ SQL-2003 ±ê×¼Öж¨ÒåµÄ timestamp Êý¾ÝÀàÐÍ¡£ SQL-2003 timestamp Êý¾ÝÀàÐ͵ÈͬÓÚ Transact-SQL datetime Êý¾ÝÀàÐÍ¡£
ÎҵIJâÊÔ½á¹û:
--½¨Á¢Ò»¸öTable
create table tmp1
(
name varchar(20),
timestamp
)
go
--²åÈë¼Ç¼
insert into tmp1 values('tony',null)
select * from tmp1
go
--Ö´Ðнá¹û(ÒòΪ֮ǰÒѾÓвåÈë¹ýÁË.ËùÒÔÊÇD):tony 0x000000000000300D
--Ð޸ļǼ
update tmp1 set name='tonywu'
select * from tmp1
go
--Ö´Ðнá¹û:tonywu 0x000000000000300E
update tmp1 set name='tony wu'
select * from tmp1
go
--Ö´Ðнá¹û:tony wu 0x000000000000300F
--ÔÙ²åÈëÒ»±Ê
insert into tmp1 values('wgj',null)
select * from tmp1
--Ö´Ðнá¹û:
--tony wu 0x000000000000300F
--wgj 0x0000000000003
Ïà¹ØÎĵµ£º
SQL×¢Èë¼òµ¥·ÖÎö
ʾÀýÓï¾ä£º
select * from admintable where adminName like '%a%'
ÔÚ²éѯÖÐÎÒÃÇÒ»°ãÔÚaÕâ¸öµØ·½ÓɽçÃæ´«È벻ͬµÄÖµ£¬µ±ÎÒÃÇÔÚaÕâÀï´«ÈëµÄֵΪ“'”µ¥ÒýºÅʱ£¬Æ´´Õ³ÉµÄSQLÓï¾ä¾ÍÈçÏ£º
select * from admintable where adminName like '%'%'
Ö´ÐÐÕâ¾äÓï¾äÎÒÃǻᷢÏÖ³öÏÖÒÔÏÂÒì³££º
......
2008µÄSSMS±È2005°æÒª¶àÏûºÄÒ»±¶×óÓÒµÄÄڴ棬¶øÇÒËƺõ²»»á×Ô¼ºÊÍ·Å£¬ÖÁÉÙÒ²ÊÇÄÚ´æ¹ÜÀí²»ÊǺܺÏÀí£¬ÍùÍù´ò¿ª¼¸¸ö²éѯ´°¿Ú½øÐвéѯºóÄÚ´æ¾Í»áÉýµ½ÄÑÒÔ200MBµ½300MB£¬ÇҹصôºóÄÚ´æ²»»áÊÍ·Å£¬¶ø2005µÄSSMSÒ»°ãÖ»ÊÇÔÚ100MB×óÓÒ¡£¶ÔÓµÓдóÄÚ´æµÄµçÄÔÀ´ËµÕâ¿ÉÄܲ»Ëãʲô£¬µ«¶ÔÄÚ´æÖ»ÓÐ1G»ò¸üÉÙµÄÓû§À´Ëµ£¬Õ⼸ºõÊDz»¿ÉÈÝÈ̵ģ¬ÒòÎ ......
ÔÚʹÓÃODP.NET½øÐÐOracle±à³Ìʱ£¬ÓÐʱºòSQLÓï¾ä·Ç³£¸´ÔÓ£¬ÐèÒª²ÉÓö¯Ì¬¹¹Ôì²éѯÓï¾äµÄÇé¿ö£¬ÓÐÁ½ÖÖ·½·¨¿ÉÒÔ¹¹Ô춯̬µÄSQLÓï¾ä£¬²¢Ö´Ðзµ»Ø½á¹û¼¯¡£
1¡¢ÔÚÊý¾Ý·ÃÎʲ㹹ÔìSQLÓï¾ä
ÀýÈçÏÂÃæµÄÓï¾ä£¬½«¹¹ÔìÍêÕûµÄSQLÓï¾ä¸³Öµ¸øCommandText£¬ÔÙ´«µÝµ½Êý¾Ý¿â½øÐÐÖ´ÐУ¬·µ»Ø½á¹û¼¯¡£
loadCommand.CommandType = Com ......
±¾ÏµÁÐÎÄÕµ¼º½
[Oracle]¸ßЧµÄSQLÓï¾äÖ®·ÖÎöº¯Êý(Ò»)--sum()
[Oracle]¸ßЧµÄSQLÓï¾äÖ®·ÖÎöº¯Êý(¶þ)--max()
[Oracle]¸ßЧµÄSQLÓï¾äÖ®·ÖÎöº¯Êý(Èý)--row_number() /rank()/dense_rank()
[Oracle]¸ßЧµÄSQLÓï¾äÖ®·ÖÎöº¯Êý(ËÄ)--lag()/lead()
ÓÐʱºò±¨±íÉÏÃæÐèÒªÏÔʾ¸Ã±Ê²Ù×÷µÄÉÏÒ»²½Öè»òÕßÏÂÒ»²½ÖèµÄÏêϸÐÅÏ¢£¬Õâ¸öʱºò¿ ......