CAST( ) function in SqlServer

Syedshakeer
Posted by Syedshakeer under Sql Server category on | Views : 15830
CAST( ) function is used to convert a data type varible or data from one data type to another data type

below is the example for Converting a varchar data type to int data type using CAST( ) function

declare @a varchar(2)

declare @b varchar(2)

set @a=10

set @b=20

Select CAST(@a as int) + CAST(@b as int) as Result

OutPut:-

Result


30

Comments or Responses

Login to post response