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
select @bigString = sResponse
from S1_LogAQ a
where a.lRowID = 5288
-- get the total length of the big string
declare @totalLen int
set @totalLen = len(@bigString)
declare @size int
, @start int
, @sub varchar(max)
-- set the start position
set @start = 1
-- set the number of characters to print on each line
set @size = 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, @size)
-- print it
print @sub
-- set the start position for the next time around
set @start += len(@sub)
end
Last modified by Mohit @ 4/12/2025 10:29:59 PM