Labels

Wednesday, April 3, 2013

TRY_PARSE


-- TRY_PARSE() function to translate value into specific datatype without throwing exceptions on failure

-- If the parse operation is successful, this function returns the resultant value; Otherwise, it returns NULL value.

SELECT TRY_PARSE('2011-01-01' AS datetime2 USING 'en-US') AS Result

GO

SELECT TRY_PARSE('Test' AS datetime2 USING 'en-US') AS Result

No comments:

Post a Comment