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 |
|
yashish444
Starting Member
3 Posts |
Posted - 2010-08-16 : 05:03:11
|
hiI need to insert the value '27/02/2005' to a "datetime" sql server field.can't do any manipulation of this value via application, it must be in an sql statement.when I try this:[CODE]insert into disma (startdate) values( '27/02/2005' )[/CODE]I get:quote: "Out of range value for column 'startdate' at row 1"
it's because the value is in the format dd/mm/yyyy and not mm/dd/yyyy I tried this:[HTML]insert into disma (startdate) values( convert(datetime, '27/02/2005', 105) );[/HTML] got:quote: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''27/02/2005', 105) )' at line 1"
suggestions please? |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2010-08-16 : 05:04:47
|
1) Use unambigous datetime formatting like ANSI or ISO formatinsert into disma (startdate) values('20050227')2) or, make your sql server understand you are using day-month-year data, like thisset dateformat dmyinsert into disma (startdate) values( '27/02/2005' ) N 56°04'39.26"E 12°55'05.63" |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2010-08-16 : 05:05:15
|
Oh, I see now you are not even using Microsoft SQL Server! N 56°04'39.26"E 12°55'05.63" |
 |
|
|
yashish444
Starting Member
3 Posts |
Posted - 2010-08-16 : 05:30:24
|
| oh crap....this is mysql...errr....hmmmmm.... nevermind...I feel like a complete arse ! |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-08-16 : 10:50:55
|
quote: Originally posted by yashish444 oh crap....this is mysql...errr....hmmmmm.... nevermind...I feel like a complete arse !
try your luck at www.dbforums.com------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|