SqlServerÖÐÓÃ@@IDENTITYÈ¡×îÐÂID²»×¼µÄÎÊÌâ
Ò»¸öÍøÓÑÎÊÎÒÒ»¸ö¹ØÓÚ@@IDENTITYµÄÎÊÌâ¡£ËûµÄÊý¾Ý¿âÖÐÓÐÒ»¸ö´æ´¢¹ý³Ì£¬ÓÐ insertÓï¾ä£¬È»ºóÂíÉϾÍÓÃSELECT @@IDENTITYÈ¡¸Õ²åÈëµÄIDÖµ£¬Í¨³£ÕâÊÇûÓÐÎÊÌâµÄ£¬µ«ÊÇÎÊÌâÊÇIDʵ¼ÊÉÏÒѾ´ïµ½ÁË100¶àÍòÁË£¬¶ø SELECT @@IDENTITY ·µ»ØµÄÖ»ÓкÜСµÄÖµ(²Å30¶à)£¬ÁîÈ˷ѽ⡣
ÎÒ¿ªÊ¼Ò²²»Ì«Ã÷°×£¬ÎÊËûÏȱð¹Ü@@IDENTITY£¬Ð²åÈë¼Ç¼£¬IDÊǶàÉÙ¡£Ëû˵IDÊÇ100¶àÍòÄÇô´óµÄÊý¡£²»ÊDzż¸Ê®ÄÇôС¡£ÎÒ°ïËû·ÖÎö¿ÉÄÜÐÔ£¬ÊDz»ÊÇidentityµ½ÁË×î´óÏÞ£¬ÇÒidentity×î´óÊÇ2µÄ64´Î·½¡£Ëû˵int ×î´óÖµÊÇ 2,147,483,647£¬ËûµÄIDÀëÒç³ö»¹ÔçÄØ£¬ µ«ÊÇ return @@IDENTITY ¾ÍÊÇ ºÜСµÄÖµ£¨Ö»Óм¸Ê®)¡£ÎÒÈ»ºóÓÖ°ïËû·ÖÎöµÀ£¬ÊDz»ÊÇIDµÄÖµ±»ÖØÖùý£¿Ëû˵²»ÊÇ£¬Ëû˵ÏÖÔÚвåÈëµÄ id ¾ÍÊÇ 170¶àÍò¡£Ëµµ½ÕâÀÎÒÁ˽âÁËÒ»µãÁË¡£ÎÒ½¨ÒéËûÓÃscope_identity(table_name)º¯ÊýÀ´È¡Ö¸¶¨±íµÄIDENTITY¡£ÎÒÃÇÒÔÇ°Óйý¾Ñ飬@@IDENTITYºÍIDENTITY_CURRENT()¶¼²»ÊǺÜÀíÏ룬ÒòΪËüÃÇ»áÊܵ±Ç°±íµÄ·¶Î§Ó°Ï졣ͨ³£Óд¥·¢Æ÷¾Í»áÒýÆð@@IDENTITY²»ÄÜÕýÈ·µØÈ¡Öµ£¬IDENTITY_CURRENT()Ò²ÊÇÈç´Ë¡£ÐÒºÃÓÐscope_identity(table_name)º¯Êý¡£ÔÚÕâÖÖÇé¿öϾÍÖ»ÄÜÓÃÕâ¸ö¡£ÕâʱËû²ÅÏëÆðÀ´£¬ËûµÄ±íÓд¥·¢Æ÷¡£ºÇºÇ£¬³ÙÁ˵㡣ÎÒ½¨ÒéËû×îºÃ²»ÒªÓô¥·¢Æ÷¡£ÄܱÜÃâ¾Í±ÜÃâ¡£Ëû˵Õâ¸ö´¥·¢Æ÷ÊÇ¿ÉÒÔÓñðµÄ·½Ê½´úÌæµÄ¡£Ëû»áÊÔÒ»ÏÂÓÃscope_identity(table_name)º¯ÊýºÍÈ¥³ý´¥·¢Æ÷¡£
Ïà¹ØÎĵµ£º
È«ÎļìË÷ÊǶԴóÊý¾ÝÎı¾½øÐÐË÷Òý£¬ÔÚ½¨Á¢µÄË÷ÒýÖжÔÒª²éÕҵĵ¥´Ê½øÐнøÐÐËÑË÷£¬¶¨Î»ÄÄЩÎı¾Êý¾Ý°üÀ¨ÒªËÑË÷µÄµ¥´Ê¡£Òò´Ë£¬È«ÎļìË÷µÄÈ«²¿¹¤×÷¾ÍÊǽ¨Á¢Ë÷ÒýºÍÔÚË÷ÒýÖÐËÑË÷¶¨Î»£¬ËùÓеŤ×÷¶¼ÊÇΧÈÆÕâÁ½¸öÀ´½øÐеġ£ÏÂÃæ¾ÍÖð¸ö½éÉÜ¡£
¡¡¡¡½¨Á¢È«ÎÄË÷ÒýÖÐÓÐÁ½Ïî·Ç³£ÖØÒª£¬Ò»¸öÊÇÈçºÎ¶ÔÎı¾½øÐзִʣ¬Ò»Êǽ¨Á¢Ë÷ÒýµÄÊý¾Ý½á¹¹¡ ......
bcpÃüÁîÊÇSQL ServerÌṩµÄÒ»¸ö¿ì½ÝµÄÊý¾Ýµ¼Èëµ¼³ö¹¤¾ß¡£Ê¹ÓÃËü²»ÐèÒªÆô¶¯ÈκÎͼÐιÜÀí¹¤¾ß¾ÍÄÜÒÔ¸ßЧµÄ·½Ê½µ¼Èëµ¼³öÊý¾Ý¡£bcpÊÇSQL ServerÖиºÔðµ¼Èëµ¼³öÊý¾ÝµÄÒ»¸öÃüÁîÐй¤¾ß£¬ËüÊÇ»ùÓÚDB-LibraryµÄ£¬²¢ÇÒÄÜÒÔ²¢Ðеķ½Ê½¸ßЧµØµ¼Èëµ¼³ö´óÅúÁ¿µÄÊý¾Ý¡£bcp¿ÉÒÔ½«Êý¾Ý¿âµÄ±í»òÊÓͼֱ½Óµ¼³ö£¬Ò²ÄÜͨ¹ýSELECT fromÓï¾ä¶Ô±í»òÊÓ ......
ÒòΪ¹¤×÷ÐèÒª£¬Êý¾Ý¿âʹÓõÄMS SQL Server2005£¬¶øĬÈϵÄÅÅÐò¹æÔòÊÇSQL_Latin1_General_CP1_CI_AS¡£´´½¨ÁËÒ»¸ö±í£¬ÒòΪÐèÒª´æ´¢ÖÐÎÄÐÅÏ¢£¬Address×ֶεÄÀàÐÍÊÇnvarchar(255)¡£
´ËʱʹÓÃphpÀ´Á¬½Ósql server£¬Ò³ÃæµÄ±àÂëºÍÎļþµÄ±àÂ붼ÊÇUTF-8£¬²éѯ´ËAddress×ֶΣ¬ÏÔʾÔÚÒ³ÃæÉÏÊÇ???Ö®ÀàµÄ¡£Ôõô½â¾ö£¿
ʹÓÃ
iconv('iso- ......
ÔÚƽʱµÄ¹¤×÷¹ý³ÌÖУ¬×÷ΪDBA½ÇÉ«¹ÜÀíÊý¾Ý¿â£¬Í·ÄÔÖеÄÓ¡ÏóÍùÍùÊÇÊý¾Ý¿âʵÀýÃû³Æ£¬¶ø²»»áÈ¥¹ØÐÄServerµÄIP£¬¶ø×÷ΪDeveloperµÄ½ÇÉ«£¬ËûÃÇÍùÍùÏëÖªµÀÖªµÀServer IpºÍ¶Ë¿ÚºÅ¡£ËùÒÔ£¬DBA»á¾³£±»Îʼ°µ½£ºXXXʵÀýµÄIPºÍ¶Ë¿ÚºÅÊÇʲô£¿
Õâ¸öÎÊÌ⣬µ±È»ÎÒÃÇ¿ÉÒÔLoginµ½OS²é¿´IP¡¢Ê¹ÓÃÅäÖƹÜÀí¹¤¾ß»ñÈ¡µ½¶Ë¿ÚºÅ¡£µ«ÊÇ£¬Õâ¸ö·½·¨·Ç ......
SQLserverÖÐÓÃconvertº¯Êýת»»ÈÕÆÚ¸ñʽ
2008-01-23 15:47
SQLserverÖÐÓÃconvertº¯Êýת»»ÈÕÆÚ¸ñʽ2008-01-15 15:51SQLserverÖÐÓÃconvertº¯Êýת»»ÈÕÆÚ¸ñʽ
SQL ServerÖÐÎÄ°æµÄĬÈϵÄÈÕÆÚ×Ö¶Îdatetime¸ñʽÊÇyyyy-mm-dd Thh:mm:ss.mmm
ÀýÈç:
select getdate()
2004-09-12 11:06:08.177
ÕûÀíÁËÒ»ÏÂSQL ServerÀïÃæ¿ÉÄÜ ......