View Single Post

   
  #1 (permalink)  
Old 02-29-2008, 04:14 AM
TinTin
 
Posts: n/a
Default Concatinating Variables

Hello,

How do I concatinate a variable. Here's the scenarios:

declare @var1 varchar(20)
declare @var2 varchar(20)
declare @var3 varchar(20)
declare @var4 varchar(20)
..
..
declare @var32 varchar(20)

set @var1 = 'Something 1'
set @var2 = 'Something 2'
....
set @var32 = 'Something 3'

/* I have to store the values of these individual variables. I wish to
have a "While" routine which iterates through the above variables. I
wish to have the variable name concatinated as that I do not have to
write numerous lines of code setting up individual 32 variables. How
could I use the '+' operator to join 'var' + @count . Where count is
from 1 through 32. I am having some trouble with the syntax.*/

Regards,
VS
Reply With Quote