troubleshooting Question

Stored Procedure is Barfing on Date using Microsoft Text Driver

Avatar of davidcahan
davidcahanFlag for United States of America asked on
Microsoft SQL Server 2005
3 Comments1 Solution201 ViewsLast Modified:

I'm reading a CSV file that is ftp'd to our server every night.  I'm using a microsoft text driver to open the file and read it directly in my Stored Procedure.  It suddenly seems to be barfing on any date that is like this:

2007-10-29 19:35:13.503000000

The error is: Conversion failed when converting datetime from character string.

I've tried casting, converting.  and that in itself throws an error also.  it just does not like the date like this

K, so here are my questions.

1) does this have something to do with the text driver?
2) do i need the person generating the file for me to strip out the time element on his side because SQL Server can't handle milliseconds to that degree
3) if this is the text driver, is there a better way to read the data.  some other kind of driver?

Now, i can't remember ever see milliseconds that long before but, hey, i guess in different DB systems that is possible.  
Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros