while循环在sql server中 [英] while loop in sql server
本文介绍了while循环在sql server中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
hi
i在sql server中进行循环访问param1,param2和param3的值
hi
i am making loop in sql server to access the value from param1,param2 and param3
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
这里@param不是参与者的错误
i希望从单行中获得3个参数值
谢谢
here @param is not paramter eror come
i want that get value from 3 paramter in single line
thanks
推荐答案
你做不到。参数必须在编译时解决,而不是在运行时解决。
我能看到这样做的唯一原因是有一个可变数量的参数,并且sql不允许你这样做。
你实际想要实现什么,你认为这是一个好主意?
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?
这篇关于while循环在sql server中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文