Quote:
Originally Posted by dvdfreak Thanks, this was very helpful as I'm pretty sure it's this that gives the error on your SQL:
CAST('2007/09/25' AS DATETIME)
Must be a locale thing, I'm going to look for a more correct locale-independant way of converting this date.
To confirm this, can you try to execute the following in your SQL Management Studio:
SELECT CAST('2007/09/25' AS DATETIME)
SELECT CAST('2007/25/09' AS DATETIME)
I wouldn't be surprised if the first one fails, and the second one works... EDIT
Does the following work?
SELECT CONVERT(DATETIME, '2007.09.25', 102) |
SELECT CAST('2007/09/25' AS DATETIME) -> not working. Message is:
"Meldung 242, Ebene 16, Status 3, Zeile 1
Bei der Konvertierung eines char-Datentyps in einen datetime-Datentyp liegt der datetime-Wert außerhalb des gültigen Bereichs."
SELECT CAST('2007/25/09' AS DATETIME) -> working
SELECT CONVERT(DATETIME, '2007.09.25', 102) -> working too
__________________
Some say he works as a tester for Team Mediaportal and some say that he smells bugs, even before they are written into the Code. All we know is, he's called
The Stig.