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 |
|
iquttaineh
Starting Member
4 Posts |
Posted - 2005-06-06 : 04:20:05
|
| Dear all,My problem is like that:-I have inserted many rows in MM/DD/YYYY format, but later on i had to change the format into DD/MM/YYYY, so when i do an update on any of the old rows it will generate an error on the date.Does anyone know any update statement that change the format without any problem ??? All i want is to replace the day with the month and vice versa.Best regards |
|
|
jen
Master Smack Fu Yak Hacker
4110 Posts |
Posted - 2005-06-06 : 04:40:41
|
| what's your update statement and error encountered?--------------------keeping it simple... |
 |
|
|
iquttaineh
Starting Member
4 Posts |
Posted - 2005-06-06 : 05:11:03
|
| The error message is:-The conversion of char data type to smalldatetime data type resulted in an out-of-range smalldatetime value. |
 |
|
|
raclede
Posting Yak Master
180 Posts |
Posted - 2005-06-06 : 05:14:20
|
user convert: try thisError: INSERT INTO sample (mydate) SELECT '4/1/2005' UNION ALLSELECT '30/6/2005'Server: Msg 242, Level 16, State 3, Line 1The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.The statement has been terminated.Correct:INSERT INTO sample (mydate) SELECT '4/1/2005' UNION ALLSELECT CONVERT(datetime,'30/6/2005',103)"If the automobile had followed the same development cycle as the computer, a Rolls-Royce would today cost $100, get a million miles per gallon, and explode once a year, killing everyone inside. " raclede |
 |
|
|
rockmoose
SQL Natt Alfen
3279 Posts |
Posted - 2005-06-06 : 05:56:32
|
| SET DATEFORMAT dmyrockmoose |
 |
|
|
|
|
|