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

SQL SERVERÖÐTimeStampʹÓÃ

SQL ServerÖÐÁª»ú´ÔÊé
       SQL Server timestamp Êý¾ÝÀàÐÍÓëʱ¼äºÍÈÕÆÚÎ޹ء£SQL Server timestamp ÊǶþ½øÖÆÊý×Ö£¬Ëü±íÃ÷Êý¾Ý¿âÖÐÊý¾ÝÐ޸ķ¢ÉúµÄÏà¶Ô˳Ðò¡£ÊµÏÖ timestamp Êý¾ÝÀàÐÍ×î³õÊÇΪÁËÖ§³Ö SQL Server »Ö¸´Ëã·¨¡£Ã¿´ÎÐÞ¸Äҳʱ£¬¶¼»áʹÓõ±Ç°µÄ @@DBTS Öµ¶ÔÆä×öÒ»´Î±ê¼Ç£¬È»ºó @@DBTS ¼Ó1¡£ÕâÑù×ö×ãÒÔ°ïÖú»Ö¸´¹ý³ÌÈ·¶¨Ò³Ð޸ĵÄÏà¶Ô´ÎÐò£¬µ«ÊÇ timestamp ÖµÓëʱ¼äûÓÐÈκιØϵ¡£
       timestamp ÕâÖÖÊý¾ÝÀàÐͱíÏÖ×Ô¶¯Éú³ÉµÄ¶þ½øÖÆÊý£¬È·±£ÕâЩÊýÔÚÊý¾Ý¿âÖÐÊÇΨһµÄ¡£timestamp Ò»°ãÓÃ×÷¸ø±íÐмӰ汾´ÁµÄ»úÖÆ¡£´æ´¢´óСΪ 8 ×Ö½Ú¡£
       Transact-SQL timestamp Êý¾ÝÀàÐÍÓëÔÚ SQL-92 ±ê×¼Öж¨ÒåµÄ timestamp Êý¾ÝÀàÐͲ»Í¬¡£SQL-92 timestamp Êý¾ÝÀàÐ͵ȼÛÓÚ Transact-SQL datetime Êý¾ÝÀàÐÍ¡£ 
       Microsoft® SQL Server™ ½«À´µÄ°æ±¾¿ÉÄÜ»áÐÞ¸Ä Transact-SQL timestamp Êý¾ÝÀàÐ͵ÄÐÐΪ£¬Ê¹ËüÓëÔÚ±ê×¼Öж¨ÒåµÄÐÐΪһÖ¡£µ½ÄÇʱ£¬µ±Ç°µÄ timestamp Êý¾ÝÀàÐͽ«Óà rowversion Êý¾ÝÀàÐÍÌæ»»¡£
Microsoft® SQL Server™ 2000 ÒýÈëÁË timestamp Êý¾ÝÀàÐ굀 rowversion ͬÒå´Ê¡£ÔÚ DDL Óï¾äÖо¡¿ÉÄÜʹÓà rowversion ¶ø²»Ê¹Óà timestamp¡£rowversion ÊÜÊý¾ÝÀàÐÍͬÒå´ÊÐÐΪµÄÖÆÔ¼¡£Óйظü¶àÐÅÏ¢£¬Çë²Î¼ûÊý¾ÝÀàÐÍͬÒå´Ê¡£
ÔÚ CREATE TABLE »ò ALTER TABLE Óï¾äÖУ¬²»±ØΪ timestamp Êý¾ÝÀàÐÍÌṩÁÐÃû£º
       CREATE TABLE ExampleTable (PriKey int PRIMARY KEY, timestamp)
Èç¹ûûÓÐÌṩÁÐÃû£¬SQL Server ½«Éú³É timestamp µÄÁÐÃû¡£rowversion Êý¾ÝÀàÐÍͬÒå´Ê²»¾ßÓÐÕâÑùµÄÐÐΪ¡£Ö¸¶¨ rowversion ʱ±ØÐëÌṩÁÐÃû¡£
       Ò»¸ö±íÖ»ÄÜÓÐÒ»¸ö timestamp ÁС£Ã¿´Î²åÈë»ò¸üаüº¬ timestamp ÁеÄÐÐʱ£¬timestamp ÁÐÖеÄÖµ¾ù»á¸üС£ÕâÒ»ÊôÐÔʹ timestamp Áв»ÊʺÏ×÷Ϊ¼üʹÓã¬ÓÈÆäÊDz»ÄÜ×÷ΪÖ÷¼üʹÓ᣶ÔÐеÄÈκθüж¼»á¸ü¸Ä timestamp Öµ£¬´Ó¶ø¸ü¸Ä¼üÖµ¡£Èç¹û¸ÃÁÐÊôÓÚÖ÷¼ü£¬ÄÇô¾ÉµÄ¼üÖµ½«ÎÞЧ£¬½ø¶øÒýÓøþÉÖµµÄÍâ¼üÒ²½«²»ÔÙÓÐЧ¡£Èç¹û¸Ã±íÔÚ¶¯Ì¬ÓαêÖÐÒýÓã¬ÔòËùÓиüоù»á¸ü¸ÄÓαêÖÐÐеÄλÖá£Èç¹û¸ÃÁÐÊôÓÚË÷Òý¼ü£¬Ôò¶ÔÊý¾ÝÐеÄËùÓиüл¹½«µ¼ÖÂË÷Òý¸üС£
²»¿ÉΪ¿ÕµÄ timestamp ÁÐÔÚÓïÒåÉϵȼÛÓÚ binary(8) ÁС£


Ïà¹ØÎĵµ£º

50ÖÖ·½·¨ÇÉÃîÓÅ»¯ÄãµÄSQL ServerÊý¾Ý¿â

Ô­ÎÄÁ´½Ó:http://blog.btidea.com/article.asp?id=440
²éѯËÙ¶ÈÂýµÄÔ­ÒòºÜ¶à£¬³£¼ûÈçϼ¸ÖÖ£º
¡¡¡¡
¡¡¡¡1¡¢Ã»ÓÐË÷Òý»òÕßûÓÐÓõ½Ë÷Òý(ÕâÊDzéѯÂý×î³£¼ûµÄÎÊÌ⣬ÊdzÌÐòÉè¼ÆµÄȱÏÝ)
¡¡¡¡
¡¡¡¡2¡¢I/OÍÌÍÂÁ¿Ð¡£¬ÐγÉÁËÆ¿¾±Ð§Ó¦¡£
¡¡¡¡
¡¡¡¡3¡¢Ã»Óд´½¨¼ÆËãÁе¼Ö²éѯ²»ÓÅ»¯¡£
¡¡¡¡
¡¡¡¡4¡¢ÄÚ´æ²»×ã
¡¡¡¡
¡¡¡¡5¡¢ÍøÂç ......

sql serverµÄ¸´ÖƺͶ©ÔÄ

      ×î½üÓöµ½Ò»¸öÏîÄ¿£¬¿Í»§ÔÚ×ܲ¿Â¼ÈëÐÅÏ¢ºó£¬Êý¾ÝÐèҪͬ²½µ½ÏÂÊôµÄÈô¸É¸ö×ÓϵͳÖС£ÏÖÔÚ×ܲ¿µ¥¶ÀʹÓÃÒ»¸öÊý¾Ý¿â£¬ÏÂÊôµ¥Î»¸÷×ÔʹÓÃ×Ô¼ºµÄÊý¾Ý¿â¡£
      ¶ÔÓÚÕâ¸öÎÊÌ⣬Ïëµ½Á˼¸¸ö½â¾ö·½°¸£º
     1¡¢×Ô¼ºÐ´´úÂë½â¾ö¡£¶¨ÒåºÃ·ÃÎÊÿ¸öÊý¾ ......

ms sql server ´´½¨Óû§


SQL code
´´½¨½ÇÉ«£¬Óû§£¬È¨ÏÞ
/*--ʾÀý˵Ã÷
ʾÀýÔÚÊý¾Ý¿âpubsÖд´½¨Ò»¸öÓµÓбíjobsµÄËùÓÐȨÏÞ¡¢ÓµÓбítitlesµÄSELECTȨÏ޵ĽÇÉ«r_test
Ëæºó´´½¨ÁËÒ»¸öµÇ¼l_test£¬È»ºóÔÚÊý¾Ý¿âpubsÖÐΪµÇ¼l_test´´½¨ÁËÓû§ÕË»§u_test
ͬʱ½«Óû§ÕË»§u_testÌí¼Óµ½½ÇÉ«r_testÖУ¬Ê¹Æäͨ¹ýȨÏ޼̳лñÈ¡ÁËÓë½ÇÉ«r_t ......

¾­µäSQLÓï¾ä

asc °´ÉýÐòÅÅÁÐ
desc °´½µÐòÅÅÁÐ
ÏÂÁÐÓï¾ä²¿·ÖÊÇMssqlÓï¾ä£¬²»¿ÉÒÔÔÚaccessÖÐʹÓá£
SQL·ÖÀࣺ
DDL—Êý¾Ý¶¨ÒåÓïÑÔ(CREATE£¬ALTER£¬DROP£¬DECLARE)
DML—Êý¾Ý²Ù×ÝÓïÑÔ(SELECT£¬DELETE£¬UPDATE£¬INSERT)
DCL—Êý¾Ý¿ØÖÆÓïÑÔ(GRANT£¬REVOKE£¬COMMIT£¬ROLLBACK)
Ê×ÏÈ,¼òÒª½éÉÜ»ù´¡Óï¾ä£º
1¡¢ËµÃ÷£º´´½¨Êý ......

SQLÄ£ºý²éѯ

SQLÌṩÁËËÄÖÖÄ£ºýÆ¥Å䷽ʽ
1£¬%£º±íʾÈÎÒâ0¸ö»ò¶à¸ö×Ö·û¡£¿ÉÆ¥ÅäÈÎÒâÀàÐͺͳ¤¶ÈµÄ×Ö·û£¬ÓÐЩÇé¿öÏÂÈôÊÇÖÐÎÄ£¬ÇëÔËÓÃÁ½¸ö°Ù·ÖºÅ£¨%%£©±íʾ¡£
±ÈÈç SELECT * from [user] WHERE u_name LIKE '%Èý%'
½«»á°Ñu_nameΪ“ÕÅÈý”£¬“ÕÅèÈý”¡¢“Èý½Å蔣¬“ÌÆÈý²Ø”µÈµÈÓГÈý& ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ