DECLARE @str VARCHAR (MAX);
SELECT @str = COALESCE(@str + CHAR(10), '') +
'EXECUTE CreateDeno ' + CAST(ID AS VARCHAR)
FROM GL_To_Batch_Details
WHERE TYPE = 'C' AND
Deno_ID IS NULL;
--PRINT @str;--SELECT @str;
**EXEC(@str);**
EDITED
Does EXECUTE
statement truncate strings to 8,000 chars like PRINT
? How can I execute a dynamic SQL statement having more than 8,000 chars?
Any suggestion would be warmly appreciated.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…