Why do you conclude that the result is truncated? What does datalength(@sql) return?
The output in SSMS may seem truncated, but that is a display issue. SSMS truncates PRINT output at 8000 characters or so. You can do
SELECT @sql FOR XML PATH('')
The display will be somewhat ugly, but the XML display in SSMS fits 1MB by default.
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
No comments:
Post a Comment