SQLÖÐDATEADDºÍDATEDIFFµÄÓ÷¨
SQLÖÐDATEADDºÍDATEDIFFµÄÓ÷¨
ÈÕÆÚ:2008-07-17 ×÷Õß:ϲ騰С¶þ 來Ô´:PHPChina
ͨ³££¬妳ÐèÒª獲µÃ當Ç°ÈÕÆÚºÍ計ËãһЩÆäËûµÄÈÕÆÚ£¬ÀýÈ磬妳µÄ³ÌÐò¿ÉÄÜÐèÒªÅÐ斷Ò»個ÔµĵÚÒ»Ìì»òÕß×îááÒ»Ìì¡£妳們´ó²¿·ÖÈË´ó¸Å¶¼ÖªµÀÔõ樣°ÑÈÕÆÚ進ÐзָÄê¡¢Ô¡¢Èյȣ©£¬È»áá僅僅Ó÷ָî³ö來µÄÄê¡¢Ô¡¢ÈյȷÅÔÚ幾個º¯數ÖÐ計Ëã³ö×Ô¼ºËùÐèÒªµÄÈÕÆÚ£¡
¡¡¡¡ÔÚ這ƪÎÄÕÂ裡£¬ÎÒ將¸æ訴妳ÈçºÎʹÓÃDATEADDºÍDATEDIFFº¯數來計Ëã³öÔÚ妳µÄ³ÌÐòÖпÉÄÜ妳ÒªÓõ½µÄһЩ²»Í¬ÈÕÆÚ¡£
¡¡¡¡ÔÚʹÓñ¾ÎÄÖеÄÀý×Ó֮ǰ£¬妳±Ø須×¢ÒâÒÔϵÄ問題¡£´ó²¿·Ö¿ÉÄܲ»ÊÇËùÓÐÀý×ÓÔÚ²»Í¬µÄ機Æ÷ÉÏ執ÐеÄ結¹û¿ÉÄܲ»Ò»樣£¬這ÍêÈ«ÓÉÄÄÒ»ÌìÊÇÒ»個ÐÇÆڵĵÚÒ»Ìì這個設ÖÃ決¶¨¡£µÚÒ»Ì죨DATEFIRST£©設¶¨決¶¨ÁË妳µÄ繫統ʹÓÃÄÄÒ»Ìì×÷為Ò»ÖܵĵÚÒ»Ìì¡£ËùÓÐÒÔϵÄÀý×Ó¶¼ÊÇÒÔÐÇÆÚÌì×÷為Ò»ÖܵĵÚÒ»Ìì來½¨Á¢£¬Ò²¾ÍÊǵÚÒ»Ìì設ÖÃ為7¡£¼ÙÈç妳µÄµÚÒ»Ìì設Öò»Ò»樣£¬妳¿ÉÄÜÐèÒª調Õû這ЩÀý×Ó£¬Ê¹ËüºÍ²»Í¬µÄµÚÒ»Ìì設ÖÃÏà·ûºÏ¡£妳¿ÉÒÔͨ過@@DATEFIRSTº¯數來檢²éµÚÒ»Ìì設Öá£
¡¡¡¡為ÁËÀí½â這ЩÀý×Ó£¬ÎÒ們ÏÈ復習Ò»ÏÂDATEDIFFºÍDATEADDº¯數¡£DATEDIFFº¯數計Ëã兩個ÈÕÆÚÖ®間µÄС時¡¢Ìì¡¢ÖÜ¡¢Ô¡¢ÄêµÈ時間間¸ô總數¡£DATEADDº¯數計ËãÒ»個ÈÕÆÚͨ過給時間間¸ô¼Ó減來獲µÃÒ»個еÄÈÕÆÚ¡£ÒªÁ˽â¸ü¶àµÄDATEDIFFºÍDATEADDº¯數ÒÔ¼°時間間¸ô¿ÉÒÔ閱讀΢軟聯機幫Öú¡£
¡¡¡¡Ê¹ÓÃDATEDIFFºÍDATEADDº¯數來計ËãÈÕÆÚ£¬ºÍ±¾來從當Ç°ÈÕÆÚ
Ïà¹ØÎĵµ£º
sp_configure 'allow updates', 1
GO
reconfigure with override
GO
update syscolumns set colstat = colstat & 0x0000
where id=object_id('±íÃû') and name='ÁÐÃû'
GO
sp_configure 'allow updates', 0 ......
--È«²¿µÄ¼ò·±¶ÔÕÕ
declare @jall nvarchar(4000),@fall nvarchar(4000)
select @jall=N'°¡°¢°£°¤°¥°¦°§°¨°©°ª°«°¬°°®°¯°°°±°²°³°´°µ°¶°·°¸°¹°º°»°¼°½°¾°¿°À°Á°Â°Ã°Ä°Å°Æ°Ç°È°É°Ê°Ë°Ì°Í°Î°Ï°Ð°Ñ°Ò°Ó°Ô°Õ°Ö°×°Ø°Ù°Ú°Û°Ü°Ý°Þ°ß°à°á°â°ã°ä°å°æ°ç°è°é°ê°ë°ì°í°î°ï°ð°ñ°ò°ó°ô°õ°ö°÷°ø°ù°ú°û°ü°ý°þ±¡±¢±£±¤±¥±¦±§±¨±©±ª±«±¬±±® ......
½éÉÜ
ÎÒÃÇÒ»ÆðÀ´×ö¸öʾÀý£¬ÔÚ.NETÖÐн¨Ò»¸öÀ࣬²¢ÔÚÕâ¸öÀàÀïн¨Ò»¸ö·½·¨£¬È»ºóÔÚSQL ServerÖе÷ÓÃÕâ¸ö·½·¨¡£°´ÕÕ΢ÈíËùÊö£¬Í¨¹ýËÞÖ÷ Microsoft .NET Framework 2.0 ¹«¹²ÓïÑÔÔËÐпâ (CLR)£¬SQL Server 2005ÏÔÖøµØÔöÇ¿ÁËÊý¾Ý¿â±à³ÌÄ£ÐÍ¡£ ÕâʹµÃ¿ª·¢ÈËÔ±¿ÉÒÔÓÃÈκÎCLRÓïÑÔ£¨ÈçC#¡¢VB.NET»òC++µÈ£©À´Ð´´æ´¢¹ý³Ì¡¢´¥·¢Æ÷ºÍÓ ......
ÔÚ´óÐ͵ÄÊý¾Ý¿âÓ¦ÓÃÖУ¬¾³£»áÓöµ½²¿·ÖÊý¾ÝµÄÍÑ»úºÍ¶à¸öÊý¾Ý¿âµÄºÏ²¢ÎÊÌâ¡£±ÈÈçÏÖÔÚÓÐÒ»¸öÈ«Ê¡·¶Î§Ê¹ÓõÄÓ¦ÓóÌÐò£¬Ã¿¸öÊж¼²¿ÊðÁ˵¥¶ÀµÄÏàͬµÄÓ¦ÓóÌÐò·þÎñÆ÷ºÍÊý¾Ý¿â·þÎñÆ÷£¬Ã¿¸öÔÂÐèÒª½«È«Ê¡ËùÓÐÊеÄÊý¾ÝÈ«²¿»ã×ÜÆðÀ´ÓÃÓÚ³öÈ«Ê¡µÄ±¨±í£¬ÕâÊÇÒ»Öֺܳ£¼ûµÄÊý¾Ý¿âºÏ²¢ÎÊÌâ¡£ÔÙ±ÈÈçÎÒÃÇ×öÁËÒ»¸öSmartClientµÄÓ¦ÓóÌÐò£¬Ã¿¸ö¿ ......
c06 --------------7545623Ìõ
c05---------------1032652Ìõ
vc01--------------427741Ìõ
SQL Statement from editor:
select c0602 "ÉÌÆ·±àÂë",c0625 "ÉÌÆ·ÌõÂë",
c0103 "ÉÌÆ·Ãû³Æ",c0104 "¹æ¸ñ",c060 ......