convert
-
יום רביעי 14 מרץ 2012 07:17
how to convert datetime datatype to small datetime datatype?
plz let me knw as early as u can
כל התגובות
-
יום רביעי 14 מרץ 2012 07:34The conversion of a datetime data type to a smalldatetime data type resulted in an out-of-range value..... getting ths error
- מוזג על-ידי LeoTangModerator יום שישי 16 מרץ 2012 02:16
-
יום שישי 16 מרץ 2012 02:15מנחה דיון
Hi,
Do you mean the small datetime in SQL Server? We can implicit convert datetime type to smalldatetime, or explicit convert it to samlldatetime by using cast or convert, for example:
SELECT
CAST('2007-05-08 12:35:29' AS smalldatetime)
,CAST('2007-05-08 12:35:30' AS smalldatetime)
,CAST('2007-05-08 12:59:59.998' AS smalldatetime);CAST and CONVERT (Transact-SQL)
http://technet.microsoft.com/en-us/library/ms187928.aspx
As the range of datetime is bigger than samlldatetime's, you may encounter out-of-range issue.
datetime (Transact-SQL)
http://msdn.microsoft.com/en-us/library/ms187819.aspx
smalldatetime (Transact-SQL)
http://msdn.microsoft.com/en-us/library/ms182418.aspx
You must make sure the value of datetime type within the range of samlldatetime.
Leo Tang [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.- נערך על-ידי LeoTangModerator יום שישי 16 מרץ 2012 02:45
- סומן כתשובה על-ידי LeoTangModerator יום רביעי 21 מרץ 2012 05:36