Convert Integer to String in SQL Server

vishalneeraj-24503
Posted by vishalneeraj-24503 under Sql Server category on | Points: 40 | Views : 369
Suppose,we have a variable like below:-
DECLARE @i int
SET @i = 1234


Method 1 : Use CAST function
SELECT CAST(@i as varchar(10));


Method 2 : Use CONVERT function
SELECT CONVERT(varchar(10),@i);


Method 3 : Use STR function
SELECT LTRIM(STR(@i,10));

Comments or Responses

Login to post response