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.
| Author |
Topic |
|
CRodwell
Starting Member
2 Posts |
Posted - 2004-07-21 : 06:14:29
|
| Hey ThereI have created a DTS Package that gets executed from VB. It takes a text file with + - 800 000 Records and dumps it into a table.Now my question is if one of my rows has incorrect data in it... Usually SQL will throw an error.... but I want to take that specific row and insert it into another table for instance "ERROR_TABLE".Any Ideas of how to do this?RegardsCRodwell |
|
|
cas_o
Posting Yak Master
154 Posts |
Posted - 2004-07-21 : 07:57:35
|
| I am assuming you want to quarantine the bad record into a error_table, but continue processing the rest?If the file is fixed width you could dts every column in the text file into a single varchar or char column in a staging table, then you can use substring to identify and insert to an error table, then import the good data to your final table.Otherwise dts into your multi column staging table but have all columns as varchar, move dodgy records to your error table and insert the rest to final table.Works for me.;-]... Quack Waddle |
 |
|
|
CRodwell
Starting Member
2 Posts |
Posted - 2004-07-21 : 08:08:53
|
| Thanks for the reply...I have thought of this one but if I DTS everything into a staging table with columns as varchar... how will I programmatically identify that one of those columns has incorrect data? IE: The field in question is supposed to be an integer but my DTS field has a varchar character in it... How do I identify the rows with dodgy data?Thanks for the help again! |
 |
|
|
cas_o
Posting Yak Master
154 Posts |
Posted - 2004-07-21 : 10:30:44
|
select IsNumeric('1234'),IsNumeric('123A4') ;-]... Quack Waddle |
 |
|
|
|
|
|