A very frequently asked question is how to convert an Integer to String in SQL Server. Here are 3 different ways of doing the same task:
DECLARE @i int
SET @i=98235
--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))
All of them result in the same output
Thanks! big help
ReplyDeleteThanks! big help
ReplyDeleteHelped tremendously. Thanks!
ReplyDeleteHelped tremendously! Thanks!
ReplyDeleteThanks!
ReplyDeleteThanks!
ReplyDelete