SELECT CONVERT(INT,'034A') -- Output -- Conversion failed when converting the varchar value '034A' to data type int
Solution : To overcome for above issue you can use the TRY_CONVERT function for explicit DataConversation where you can check the datatype also before converting the value.
SELECT TRY_CONVERT(INT,'012A') SELECT 'Integer Value Exist' WHERE TRY_CONVERT(INT, '12') IS NOT NULL -- OutPut -- Integer Value Exist
No comments:
Post a Comment