T-SQL Tutorial

T-SQL Try_Parse


The Try_Parse function is used for converting expressions from string to date/time and number types.

Try_Parse Syntax


TRY_PARSE ( string_value AS data_type [ USING culture ] )



Try_Parse Example


SELECT TRY_PARSE('08/17/2019' AS date USING 'en-us');
SELECT TRY_PARSE('08/17/2019 10:18:10 AM' AS date USING 'en-us');

SELECT TRY_PARSE('08/17/2019 10:18:10 AM' AS datetime USING 'en-us');
SELECT TRY_PARSE('08/17/2019 10:18:10 AM' AS datetime2 USING 'en-us');

See also:
T-SQL Functions
Cast -> Convert -> Parse -> Try_Cast -> Try_Convert