SQL Server 255 char output limit?

OK, I know I should probably hit one of the millions of SQL Server themed boards, but the fact is, I comfortable here at the straight dope!

So, in Transact SQL I can set a variable, and the max limit is 8000 characters if I understand correctly. I have some pretty long strings that I’d like to validate using something like
Select @EnrightsVar
to display the string. The problem is that there seems to be a 255 char limit on the display. I’m ASSuming there’s a set command or something to allow the entire output to be put to screen.

Thanks,

E3

I’m guessing here, but I think the problem’s actually Query Analyser rather than SQL Server. If you return a query into a grid it will truncate the strings longer than 255 characters. To get around this go to Tools/Options on the menu, select the “Results” tab and change the “Default results target” dropdown to “Results to text”. Now query output will be formatted as text without a limit.

Alternatively you could use something like:



PRINT @EnrightsVar


to send output to the message window rather than a query grid.