Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does SQL Server Management Studio 'Messages' output window have a size limit?

If outputting messages with PRINT or RAISERROR is there a buffer size limit to the window and if so can it be changed.

I've looked everywhere and but can't see the wood for the trees!

Calification: I'm intested in the amount of data the output window can display before you start removing the earlier displayed messages. It could be that it just keeps going but there must be some limit, no?

like image 620
Dog Ears Avatar asked Mar 17 '26 10:03

Dog Ears


1 Answers

I don't think there is a limit other than any limit imposed by the available memory in the machine. If there is one it is high enough to cater for most potential use cases. Take this SQL as an example:

declare @count int 
set @count = 0 
while (@count < 80000) 
begin
 print cast(@count as varchar(10)) + replicate('x', 7900)
 set @count = (@count + 1) 
end

This print 80000 rows of ~7900 characters. In my test each row is shown in the messages output window (takes a while to run though). So if there is a limit it is quite high.

EDIT

It is also worth mentioning that both PRINT and RAISERROR will truncate if the output string is too long. For example

print replicate('x', 7997) + 'end' -- Output : ...xxxxend
print replicate('x', 7998) + 'end' -- Truncated Output : ...xxxxen

declare @err varchar(max)
set @err = replicate('x', 2044) + 'end' -- Total length 2047
raiserror(@err, 1, 0) -- Output : ...xxxxend

set @err = replicate('x', 2045) + 'end' -- Total length 2048
raiserror(@err, 1, 0) -- Output Truncated with ellipses : ...xxxx...
like image 98
MrEyes Avatar answered Mar 19 '26 12:03

MrEyes



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!