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
 General SQL Server Forums
 New to SQL Server Programming
 Why Conversion error when selecting from View?

Author  Topic 

beatkeeper25
Starting Member

27 Posts

Posted - 2013-09-11 : 16:11:54
I have a view that is involved in an import. Sometimes the import will fail with the following error:

Msg 242, Level 16, State 3, Line 2
The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.

I can recreate the error just from selecting from the view. Why would something be converting when just selecting from view?

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2013-09-11 : 16:17:40
The error should tell you what you need to know. it appears the view is converting from a string to a date and the string is out of range.
Go to Top of Page

beatkeeper25
Starting Member

27 Posts

Posted - 2013-09-11 : 17:15:38
With a view a lot of columms, how do I figure out which column it is?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2013-09-11 : 17:17:38
quote:
Originally posted by beatkeeper25

Why would something be converting when just selecting from view?



Show us the definition of the view. You may also need to show us data types of the tables involved.

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-09-12 : 15:54:54
quote:
Originally posted by beatkeeper25

I have a view that is involved in an import. Sometimes the import will fail with the following error:

Msg 242, Level 16, State 3, Line 2
The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.

I can recreate the error just from selecting from the view. Why would something be converting when just selecting from view?


may be this?
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
   

- Advertisement -