|
Hi all, I am trying to implement this in a view, and i recieve this error, any idea how to fix it?
Msg 8114, Level 16, State 5, Line 2 Error converting data type varchar to numeric. all the values are stored as varchar in the database. thanks,
(comments are locked)
|
|
I would take out all of the cast functions, and see which column has non-numeric value using the 'where isnumeric(C2)=0' function this returns all rows where C2 has a value that is not numeric and you can fix the errors or delete those rows if they definitely must be numeric. Then in your main query add 'where isnumeric(C2)=1' and this will ensure that only numeric values are returned. +1 - but one thing to note is that ISNUMERIC will return 1 for a varchar that can convert to any type of number. Therefore it will include strings with 'E' and 'D' in them (for floating point number conversion). Seeing as numeric won't handle scientific notation types, it is worth coding for this case too.
Apr 12 '10 at 04:11 AM
Matt Whitfield ♦♦
+1 on your comment, Matt.
May 14 '10 at 09:45 PM
Jeff Moden
(comments are locked)
|

