I'm doing dynamic SQL to convert all columns in a table a string
so After after all I do
EXEC(@template);
where @template is the dynamic generated query so:
col1 col2 col3
---------------
1 7 13
2 8 14
3 9 15
4 10 16
5 11 17
6 12 18
(this results: 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18)
How do I assign to a variable the resulting string
something like?
DECLARE @result AS varchar(max);
SET @result = EXEC(@template);
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…