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)
 Conversion failed when converting date and/or time

Author  Topic 

Kapland
Starting Member

5 Posts

Posted - 2013-07-29 : 13:31:16
I have some code that runs exactly as I want it to, however when I change the date from 'December 2012' to 'May 13' (This is exactly how it is stored in the data) I get this error message:
Msg 241, Level 16, State 1, Line 1
Conversion failed when converting date and/or time from character string.
Warning: Null value is eliminated by an aggregate or other SET operation.

The code runs without any issues for December data. Any ideas?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2013-07-29 : 14:17:09
Show us the code and point out which column it is.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-07-30 : 02:46:09
this reason may be related to dateformat seeting/ language regional setting of the server.

Try to pass date values in unambiguos format like YYYYMMDD

http://visakhm.blogspot.in/2011/12/why-iso-format-is-recommended-while.html


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

kameswararao polireddy
Starting Member

19 Posts

Posted - 2013-08-28 : 11:11:12
You can find different types of date formats in the below link.


http://www.sql-server-helper.com/tips/date-formats.aspx

P.Kameswara rao
Go to Top of Page
   

- Advertisement -