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
 Error converting varchar to numeric. Where???

Author  Topic 

bobshishka
Yak Posting Veteran

72 Posts

Posted - 2007-12-11 : 13:56:22
Im running a DTS package that converts data in a fixed width text file to SQL table. The package runs successfully, but when I go to dump 60,000+ records in the table I get this error:

"Error Converting data type varchar to numeric."

Is there a way that I can isolate where the offending values are located so I can manually correct them?

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-12-11 : 14:03:39
Do you get some information about which row generating the error?
If so, edit the file at the given row.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

bobshishka
Yak Posting Veteran

72 Posts

Posted - 2007-12-11 : 14:06:30
No, I would love to know which row generated the error. How could I view that?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2007-12-11 : 14:19:28
I'm pretty sure that DTS allows you to specify a begin row and end row for the import. I know that bcp and BULK INSERT have this. In these utility, it's called first and last.

If DTS does have this, then you can figure out which row is having the issue by providing values to these options and doing lots of tests.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2007-12-11 : 16:01:16
Another option might be to create a Test table with all VARCHAR columns and then DTS the file into that table. Then you could run queries on the table to figure out what data is causing the issues. Another option, if you have SSIS, is to redirect errant rows to a file.
Go to Top of Page
   

- Advertisement -