Using TRY_CONVERT  in SQL Server 2012

TRY_CONVERT returns the value as the specified data_type; if an error occurs, null is returned. However if you request a conversion that is explicitly not permitted, then TRY_CONVERT fails with an error.

TRY_CONVERT conversion function is supported in SQL Server 2012, but it is not supported in Windows Azure SQL Database so you have to use TRY_CAST in Windows Azure SQL Database.

As TRY_CAST is same as  TRY_CONVERT, as CAST is analogous to CONVERT, but CONVERT's expression and style arguments are different.


See Also


Outros Idiomas