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.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Datetime Format error

Author  Topic 

dimepop
Starting Member

33 Posts

Posted - 2012-09-13 : 04:55:47
Hi i have a table with the design:
Name DataType
----------------------
name - nvarchar (50)
LastRunTime - datetime
NextRunTime - datetime

When i try to insert a date of the type
name 13-09-12 10:13 13-09-12 10:18

I get the error:
The conversion of a varchar data type to a datetime data type resulted in an out-of-range value

I think this is a valid format so why it is not working? How can i correct this?
Thanks




madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2012-09-13 : 05:03:55
DD-MM-YYYY is not the valid format. Express them in YYYYMMDD HH:MM:SS format. You should read this to have better understanding http://beyondrelational.com/modules/2/blogs/70/posts/10898/understanding-datetime-column-part-ii.aspx


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-09-13 : 10:26:22
http://visakhm.blogspot.com/2011/12/why-iso-format-is-recommended-while.html

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -