Click here to Skip to main content
15,908,834 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi
i am making loop in sql server to access the value from param1,param2 and param3


SQL
 declare @param1 char(6)='aaaaaa'
declare @param2 char(6)='bbbbb'
declare @param3 char(6)
declare @stepno int


while @stepno <=3
begin

select @param+convert(char(3),@stepno)

set @stepno=@stepno+1
end



here @param is not paramter eror come

i want that get value from 3 paramter in single line

thanks
Posted

1 solution

You can't do that. Parameters have to be resolved at "compile time", not run time.

The only reason I can see for doing this would be to have a variable number of parameters, and sql doesn't let you do that.

What are you actually trying to achieve, that you think this would be a good idea?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900