Have a problem that I am hoping someone could help with. I have stored procedure where I am assigning column values to individual variables as in the following manner
@c0 = Column A
@c1 = Column B
@c2 = Column C .... etc
In a while loop I want to reference the variables, singularly, but without naming each variable so I tried to construct a pointer (in a sense):
SELECT @Component = '@c' + CONVERT(nvarchar(5), @tCounter)
This however gives me the string literal "@c1" or "@c2" (or whatever @tCounter is at the moment)
So my question is, is it possible to refer to a variable without having to actually typing it out.
To be clearer, I am trying to flatten out a row into individual rows, per column.
Thank you all for your considerations and time.