I need to Concatenate a Varchar
and int
in T-SQL , !
Asked
Active
Viewed 1e+01k times
20
-
5As in this http://stackoverflow.com/questions/3150943/combine-varchar-column-with-int-column? – ig0774 Feb 05 '11 at 05:27
2 Answers
67
SELECT ('VarValue' + CAST(32 AS VARCHAR))

Brian
- 4,974
- 2
- 28
- 30
-
It's a best practice to declare VARCHAR variables / parameters with a length. See for example: https://sqlblog.org/2009/10/09/bad-habits-to-kick-declaring-varchar-without-length – Jon Schneider Mar 20 '14 at 19:03