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

SQL SERVER 2005ÖеÄÈÕÆÚʱ¼äÀàÐÍ

 
 
SQL SERVER 2005 ÖеÄÈÕÆÚʱ¼äÀàÐÍ
Ò»£®  Êý¾ÝÀàÐÍ
MS SQL Server 2005 ÓÐ datetime ºÍ smalldatetime Á½ÖÖ¸ñʽµÄÈÕÆÚʱ¼äÊý¾ÝÀàÐÍ¡£×¢Ò⣺ûÓе¥¶ÀµÄÈÕÆÚ»òʱ¼äÀàÐÍ¡£
 
datetime
Êý¾Ý¿âÄÚ²¿ÓÃÁ½¸ö 4 ×Ö½ÚµÄÕûÊý´æ´¢ datetime Êý¾ÝÀàÐ͵ÄÖµ¡£µÚÒ»¸ö 4 ×Ö½Ú´æ´¢»ù´¡ÈÕÆÚ£¨¼´ 1900-1-1, base date £©Ö®Ç°»òÖ®ºóµÄÈÕÆÚ¡£ÈÕÆÚ·¶Î§Îª 1753-1-1 ÖÁ 9999-12-31 ¡£µ±ÈÕÆÚΪ 1900-1-1 ʱֵΪ 0 £»Ö®Ç°µÄÈÕÆÚÊǸºÊý£»Ö®ºóÈÕÆÚÊÇÕýÊý¡£ÁíÍâÒ»¸ö 4 ×Ö½Ú´æ´¢ÒÔÎçÒ¹ºóÈýÓÖÈý·ÖÖ®Ò»£¨ 10/3 £©ºÁÃëÊýËù´ú±íµÄÿÌìµÄʱ¼ä¡£¾«È·¶ÈΪ°Ù·ÖÖ®ÈýÃ루µÈÓÚ 3.33 ºÁÃë»ò 0.00333 Ã룩¡£ÈçϱíËùʾ£¬°ÑÖµµ÷Õûµ½ .000 ¡¢ .003 ¡¢»ò .007 ÃëµÄÔöÁ¿¡£
²éѯÖУ¬ÎÒÃdz£³£ÐèÒªËÑË÷Ö¸¶¨ÈÕÆÚ·¶Î§ÄÚµÄÊý¾Ý£¬±ÈÈç·µ»Ø 1998-01-01 µ±ÌìÄÚµÄÊý¾Ý£¬Äã¿ÉÄÜ»áÕâÑùд£º
Date >= '1998-01-01 00:00:00.000' and date <= '1998-01-01 23:59:59.999'
¸ù¾ÝÉÏÃæµÄµ÷Õû¹æÔò£¬ÆäʵÕâ¾äÓï¾äµÄʵ¼ÊËÑË÷·¶Î§Îª£º
date >= '1998-01-01 00:00:00.000' and date <= '1998-01-02 00:00:00.000'
Äã»á¿´µ½Õâ°üÀ¨ÁË 1998-01-02 µÄÊý¾Ý£¬ËùÒÔ×îºÃµÄÕýÈ·µÄËÑË÷Óï¾äΪ£º
date >= '1998-01-01 00:00:00.000' and date < '1998-01-02 00:00:00.000'
smalldatetime
smalldatetime Êý¾ÝÀàÐÍ´æ´¢ÈÕÆÚºÍÿÌìµÄʱ¼ä£¬µ«¾«È·¶ÈµÍÓÚ datetime ¡£ SQL Server ½« smalldatetime µÄÖµ´æ´¢ÎªÁ½¸ö 2 ×Ö½ÚµÄÕûÊý¡£µÚÒ»¸ö 2 ×Ö½Ú´æ´¢ 1900-1-1 ºóµÄÌìÊý¡£ÁíÍâÒ»¸ö 2 ×Ö½Ú´æ´¢ÎçÒ¹ºóµÄ·ÖÖÓÊý¡£ÈÕÆÚ·¶Î§´Ó 1900-1-1 µ½ 2079-6-6 £¬Ê±¼ä¾«È·µ½·ÖÖÓ¡£ 29.998 Ãë»ò¸üµÍµÄ smalldatetime ÖµÏòÏÂÉáÈëΪ×î½Ó½üµÄ·ÖÖÓ£¬ 29.999 Ãë»ò¸ü¸ßµÄ smalldatetime ÖµÏòÉÏÉáÈëΪ×î½Ó½üµÄ·ÖÖÓ¡£
--returns time as 12:35
SELECT CAST ( '2000-05-08 12:35:29.998' AS smalldatetime )
GO
--returns time as 12:36
SELECT CAST ( '2000-05-08 12:35:29.999' AS smalldatetime )
GO
¶þ£®  ÈÕÆÚʱ¼äµÄ¸³Öµ
ÉÏÃæ˵Á˸ñʽ£¬µ±È»ÎÒÃÇÊÇûÓа취ֱ½Ó¸³ÕûÊý¸øÈÕÆÚʱ¼ä±äÁ¿µÄ¡£¸øÕâЩ±äÁ¿¸³ÖµÍ¨³£ÊǸøËüÖ¸¶¨¸öÒ»¶¨¸ñʽµÄ×Ö·û´®¡£ SQL SERVER »á×Ô¶¯½«×Ö·û´®×ª»»³ÉÈÕÆÚ¸ñʽ±£´æµÄ£¬×¢Ò⣺Êý¾Ý¿âÖÐÊDz»»á±£´æÊý¾Ý¸ñʽµÄ×Ö·û´®µÄ¡£ ÓÐÁ½Àà¸ñʽµÄÈÕÆÚ¸ñʽµÄ×Ö·û´®£¬ SQL SERVER »á·Ç³£ÇáÒ׾͓Èϳö”µÄ¡£
Ò»ÀàÊÇ ISO ʱ¼ä¸ñʽ£¨ÓÉ ISO8601 ¹æ¶¨£©£º yyyy-mm-ddT
hh:mi:ss[.mmm] £¬±


Ïà¹ØÎĵµ£º

sql 2005 ´æ´¢¹ý³Ì·ÖÒ³ java ´úÂë

 create PROCEDURE pagelist
@tablename nvarchar(50),
@fieldname nvarchar(50)='*',         
@pagesize int output,--ÿҳÏÔʾ¼Ç¼ÌõÊý
@currentpage int output,--µÚ¼¸Ò³
@orderid nvarchar(50),--Ö÷¼üÅÅÐò
@sort int,--ÅÅÐò·½Ê½£¬1±íʾÉýÐò£¬0±íʾ½µÐòÅÅÁÐ ......

²»ÖØÆôSQL·þÎñ£¬É¾³ýSQLServerϵͳÈÕÖ¾

    µ±SQLServerµÄϵͳÈÕÖ¾¹ý´ó£¬¾Í»áÒýÆðSQLServer·þÎñÆ÷ÎÞ·¨Æô¶¯µÈһϵÁÐÎÊÌâ¡£½ñÌìÎÒÓöµ½ÁËÕâ¸öÎÊÌ⣬ÔÚÍøÉÏËÑË÷ÁËһϣ¬½â¾ö·½·¨ÊÇɾ³ý¾Í¿ÉÒÔÁË£¬¿ÉÊǵ±Ç°µÄErrorLogÕýÔÚ±»SQLʹÓÃÎÞ·¨É¾³ý°¡£¬ÒªÉ¾³ýÖ»ÄÜÍ£Ö¹SQL·þÎñÆ÷£¬ÄѵÀ¾ÍûÓбðµÃ°ì·¨ÁËÂð£¿
    »Ø´ðÊǿ϶¨µÄ£ºÊ¹ÓÃÒÔÏ´洢¹ý³Ì£º ......

SQL Server ÄêÔÂÈÕ¼ÆËã

SQL Server 2000/2005 ÄêÔÂÈÕ¼ÆËã·½·¨
ͨ³££¬ÄãÐèÒª»ñµÃµ±Ç°ÈÕÆںͼÆËãһЩÆäËûµÄÈÕÆÚ£¬ÀýÈ磬ÄãµÄ³ÌÐò¿ÉÄÜÐèÒªÅжÏÒ»¸öÔµĵÚÒ»Ìì»òÕß×îºóÒ»Ìì¡£ÄãÃÇ´ó²¿
·ÖÈË´ó¸Å¶¼ÖªµÀÔõÑù°ÑÈÕÆÚ½øÐзָÄê¡¢Ô¡¢Èյȣ©£¬È»ºó½ö½öÓ÷ָî³öÀ´µÄÄê¡¢Ô¡¢ÈյȷÅÔÚ¼¸¸öº¯ÊýÖмÆËã³ö×Ô¼ºËùÐèÒªµÄÈÕÆÚ£¡ÔÚÕâƪÎÄÕÂÀÎÒ½«¸æËßÄã
ÈçºÎÊ¹Ó ......

¶àÌõ¼þ²éѯ´æ´¢¹ý³Ì SQL Server


¶àÌõ¼þ²éѯ´æ´¢¹ý³Ì
 ¶àÌõ¼þ²éѯ´æ´¢¹ý³Ì ÀýÒ»
create proc pr_select_Natural
(
 @CDATE  datetime,
 @FAC_NAME varchar(50),
 @BATTERY_TYPE varchar(20),
 @MAKE_MODE varchar(20),
 @PRODUCE_MODE varchar(20),
 @YEAR  char(4),
 @MONTH  char(2 ......

ÎÒÏëÓÃÒ»ÌõSQLÏÔʾÕâÑùµÄ½á¹û

²»ÖªµÀÕâÑùµÄÒªÇóÄܲ»ÄÜʵÏÖ£¿
±ÈÈçÎÒÓÐÒ»ÕűíT1£¬ÀïÃæÖ»ÓÐÒ»¸ö×Ö¶Î1
ÀïÃæÓÐ100Ìõ¼Ç¼£¬ÈçÏÂËùʾ£º
×Ö¶Î1
A1
A2
A3
A4
...
A100
ÎÒÏëÓÃÒ»ÌõSQLÏÔʾÕâÑùµÄ½á¹û
µÚÒ»ÁР   µÚ¶þÁР   ...        µÚÊ®ÁÐ
A1        A11    &nb ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ