February 27, 2015 at 12:01 am
Hi There,
how to fetch records which throws error?
For example
I'm inserting records from a table to another table, having multiple columns
SampleQuery :
insert into tableB (col1,col2....col10)
select col1,col2....col10 from tableA
* while executing this query im getting error. (like varchar cant convert to numberic)
* Here I have no clue in which column it is
* also dont know which row causes it
How to fix this?
February 27, 2015 at 12:08 am
Some days, it helps if you think before typing...
you could do it in batches and use a TRY CATCH block for the failure, and write the failed group of records to another table...
February 27, 2015 at 12:13 am
pietlinden (2/27/2015)
Some days, it helps if you think before typing...you could do it in batches and use a TRY CATCH block for the failure, and write the failed group of records to another table...
Im currently doing that. But I wonder is there any features in sql to do so.
February 27, 2015 at 4:57 am
* while executing this query im getting error. (like varchar cant convert to numberic)
* Here I have no clue in which column it is
* also dont know which row causes it
That error message gives you a strong clue: your source column is varchar() and your destination is numeric(). Start checking datatypes and make sure that they match – or that you explicitly handle the conversions in your source query.
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply