20

I need to Concatenate a Varchar and int in T-SQL , !

Sudantha
  • 15,684
  • 43
  • 105
  • 161
  • 5
    As in this http://stackoverflow.com/questions/3150943/combine-varchar-column-with-int-column? – ig0774 Feb 05 '11 at 05:27

2 Answers2

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
8
varcharName + cast(intName as varchar) as full_name

Should do it

Ralph
  • 438
  • 6
  • 17