Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Replacing one field with the numeric equivalent of a fie
Message
 
 
To
26/03/2008 15:39:28
General information
Forum:
Microsoft SQL Server
Category:
Other
Miscellaneous
Thread ID:
01305881
Message ID:
01305921
Views:
16
>>It means that Field1 has values that cannot be converted to numeric(20,0).
>
>I have some records that have an empty values on Field1. So, that might be the reason. So, in order to achieve a complete conversion, I would have to put "0" in those empty values. Then, I can replace them with "" after.
>
>Thanks

Or you can use CASE.
... field2 = CASE WHEN LEN(field1)=0 THEN 0.0 ELSE CAST(field1 AS NUMERIC(20,0)) END
Also you can use ISNUMERIC() function or my UDF ufn_IsNumericEx to find "bad" values.
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform