How to use CAST and CONVERT statements in SQL server administration

Опубликовано: 22 Апрель 2026
на канале: DevNetEng
6
0

--Occasionally, you may have to change the data type the column has been assigned to another data type so as to allow reports or queries that have calculated fields.
--This can be achieved using two key commands: cast and convert. The syntax for command:

--CAST (expression AS data type)
--CONVERT (data type, expression, style)

--There are two types of conversion; implicit, which the SQL server does automatically and explicit that must be done by the user.