SQL Server Type Conversion Functions
This page lists the commonly used data type conversion functions in SQL Server.
Use TRY_CONVERT() when a supported conversion may fail and the query should receive NULL for invalid values; use CONVERT() for explicit conversions that should raise an error on invalid input.
-
CAST
TheCAST()function is a type conversion function in SQL Server that converts a value of one data type to another. -
CONVERT
The SQL ServerCONVERT()function is used to convert a value of one data type to another data type. -
TRY_CONVERT
Learn how SQL Server TRY_CONVERT() returns NULL for failed conversions, supports date styles, and still rejects explicitly disallowed conversions.