![]() ![]() To solve this issue, you can use TRY_CAST(), TRY_CONVERT() or TRY_PARSE() functions to check if the value can be converted or not, if so, the function will return the conversion result, else it will return a NULL value. As an example, many times you may face bad date values such as “” these values cannot be converted and will throw a data conversion exception. One of the main issues of the data type conversion functions is that they cannot handle the erroneous value. TRY_CAST(), TRY_CONVERT() and TRY_PARSE() As an example, if we try to parse value without passing the culture information, it will fail since “dd/MM/yyyy” is not supported by the default language settings.īut, if we pass “AR-LB” as culture (Arabic – Lebanon), where “dd/MM/yyyy” is supported, the conversion succeeds: If the culture info is not specified, PARSE() acts similar to CAST() function, but when the culture is passed within the expression, the function tries to convert the value to the desired data type using this culture.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |