|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Thursday, March 28, 2013 3:32 AM
Points: 18,
Visits: 50
|
|
| I have a staging data which holds all data as NVARCHAR, I am now loading from the staging table to specific tables where I convert various fields to numerics, but I'm getting a conversion error. Is there any easy way of finding which row is causing the problem. I've searched through the forum for this error but couldn't find anything that matches my specific needs.
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Today @ 3:56 AM
Points: 15,
Visits: 321
|
|
Next piece of code will not give you the rows, but it contains a hint on what to use to find those rows 
WITH ListValues AS ( SELECT N'123' AS Value UNION SELECT N'ABC' UNION SELECT '12AB' ) SELECT Value + ' : ' + , CASE ISNUMERIC(Value) WHEN 1 THEN 'IS NUMERIC' WHEN 0 THEN 'IS NOT NUMERIC' END FROM ListValues
123 : IS NUMERIC 12AB : IS NOT NUMERIC ABC : IS NOT NUMERIC
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Sunday, May 05, 2013 7:23 PM
Points: 133,
Visits: 1,060
|
|
|
|
|