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 |
|
renu
Starting Member
47 Posts |
Posted - 2007-10-15 : 01:38:03
|
| declare @table table(c1 int,c2 datetime)insert into @table (c1,c2) values(1,'14/01/2007')when i execute this the following error appears:The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.The statement has been terminated. |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-10-15 : 01:41:37
|
Always use ISO (yyyymmdd) format while inserting datetime data manually:declare @table table(c1 int,c2 datetime)insert into @table (c1,c2) values(1,'20070114') Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
renu
Starting Member
47 Posts |
Posted - 2007-10-15 : 02:01:45
|
| ya, but when i put c2 value as '13/01/2007'in that case my value gets inserted.but from 14 and above date my values r not getting inserted it throw the above error.declare @table table(c1 int,c2 datetime)insert into @table (c1,c2) values(1,'14/01/2007') |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-10-15 : 02:21:17
|
| so why exactly aren't you listening to harsh's advice??_______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenpSSMS Add-in that does a few things: www.ssmstoolspack.com |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-10-15 : 02:32:32
|
declare @table table(c1 int,c2 datetime)SET DATEFORMAT DMYinsert into @table (c1,c2) values(1,'14/01/2007')will also work. E 12°55'05.25"N 56°04'39.16" |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-10-15 : 03:06:57
|
quote: Originally posted by renu ya, but when i put c2 value as '13/01/2007'in that case my value gets inserted.
How?What is the dateformat of the server?Run this and seeDBCC UseroptionsMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|