Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
arkiboys
Master Smack Fu Yak Hacker
1433 Posts |
Posted - 2007-05-21 : 05:46:10
|
| declare @ValueDate smalldatetimeset @ValueDate = '21/05/2007'select @ValueDateerror:The conversion of char data type to smalldatetime data type resulted in an out-of-range smalldatetime value.Please note, if '05/21/2007' is used then there is no error.How is it possible to get 'dd/mm/yyyy' as above to work please?Thanks |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-05-21 : 05:49:15
|
always use ISO format to specify the date string. Using MM/DD/YYYY or DD/MM/YYYY is depending on your language locale settings.declare @ValueDate smalldatetimeset @ValueDate = '20070521'select @ValueDate KH |
 |
|
|
arkiboys
Master Smack Fu Yak Hacker
1433 Posts |
Posted - 2007-05-21 : 05:52:22
|
quote: Originally posted by khtan always use ISO format to specify the date string. Using MM/DD/YYYY or DD/MM/YYYY is depending on your language locale settings.declare @ValueDate smalldatetimeset @ValueDate = '20070521'select @ValueDate KH
helloHow do I convert my date '21/05/2007' to the format you suggest?Thanks |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-05-21 : 05:57:40
|
Where is the source of input for the date 21/05/2007 ? You can use convert() to convert to datetimeselect @ValueDate = convert(datetime, '21/05/2007', 103) KH |
 |
|
|
|
|
|