Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Updating a numeric field with a character field
Message
 
 
To
29/10/2014 11:13:53
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2012
Application:
Web
Miscellaneous
Thread ID:
01610090
Message ID:
01610105
Views:
24
>>Use ISNUMERIC() function
>>
>>
>>UPDATE Client SET Amount2 = 
>>CASE WHEN ISNUMERIC(Amount ) = 1 THEN CAST(Amount AS INT) ELSE 0 END)
>>
>
>Thanks, this is good to know.

If you're using SQL Server 2012 or later, check TRY_CAST() function.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform