convert
-
2012년 3월 14일 수요일 오전 7:17
how to convert datetime datatype to small datetime datatype?
plz let me knw as early as u can
모든 응답
-
2012년 3월 14일 수요일 오전 7:34The conversion of a datetime data type to a smalldatetime data type resulted in an out-of-range value..... getting ths error
- 병합됨 LeoTangModerator 2012년 3월 16일 금요일 오전 2:16
-
2012년 3월 16일 금요일 오전 2: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 2012년 3월 16일 금요일 오전 2:45
- 편집됨 LeoTangModerator 2012년 3월 16일 금요일 오전 2:45
- 답변으로 표시됨 LeoTangModerator 2012년 3월 21일 수요일 오전 5:36

