Output long strings
Use the following SQL to output long strings in SQL Management Studio.
-- declare a variable to hold our big string declare @bigString varchar(max) -- ************************************************************************** -- Add code to store the big string into our @bigString variable -- ************************************************************************** -- get the total length of the big string declare @totalLen int set @totalLen = len(@bigString) declare @sizePerLine int , @start int , @sub varchar(max) -- set the start position set @start = 1 -- set the number of characters to print on each line set @sizePerLine = 5000 -- keep going while the start position is within the size of the big string while (@start <= @totalLen) begin -- get the substring to print set @sub = substring(@bigString, @start, @sizePerLine) -- print it print @sub -- set the start position for the next time around set @start += len(@sub) end