SET @count = 0
SET @select = ''
WHILE @count < @c_count
BEGIN
SET @count = @count+1.
SET @select = @select+'cinema'+cast(@count AS VARCHAR)+'+'
END
SET @select = SUBSTRING(@select, 1, LEN(@select) - 1)
select @qty = qty from #qty
SET @buffer = 'UPDATE #table SET total_sales = '+@select
PRINT @buffer
EXEC(@buffer)
update #table set total_quantity = tq.qty from #table t inner join #qty tq on t.pkey =tq.id
这是我更新#table的代码,我在将最后一次更新放入@buffer时遇到问题,请帮帮我。