declare @Pipno varchar(500)
select @Pipno = (V_3) from REPORTDATE // here V-3 contain more than five rows
select @Pipno但是在select @Pipno中只打印一行(即V_3的最大值),我想在这个@Pipno变量中存储所有五行或更多行,请回复我
发布于 2011-10-17 13:36:55
您可以使用表变量。
declare @Pipno table(V_3 varchar(500))
insert into @Pipno
select V_3
from REPORTDATE
select V_3
from @Pipno或者,如果您希望结果为一个字符串。
declare @Pipno varchar(500)
set @Pipno = ''
select @Pipno = @Pipno + V_3 + ' '
from REPORTDATE
select @Pipnohttps://stackoverflow.com/questions/7789718
复制相似问题