# SQL Server 255 char output limit?

**URL:** <https://boards.straightdope.com/t/sql-server-255-char-output-limit/270295>\
**Category:** Factual Questions\
**Created:** [October 20, 2004, 10:31pm UTC](https://boards.straightdope.com/t/sql-server-255-char-output-limit/270295 "2004-10-20T22:31:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Enright3](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/enright3/32/2897_2.png) [@Enright3](https://boards.straightdope.com/u/Enright3)\
**Post date:** [October 20, 2004, 10:31pm UTC](https://boards.straightdope.com/t/sql-server-255-char-output-limit/270295/1 "2004-10-20T22:31:38Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Armilla](https://avatars.discourse-cdn.com/v4/letter/a/e19b73/32.png) [@Armilla](https://boards.straightdope.com/u/Armilla)\
**Post date:** [October 20, 2004, 11:27pm UTC](https://boards.straightdope.com/t/sql-server-255-char-output-limit/270295/2 "2004-10-20T23:27:10Z")

</div>

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:

```auto

PRINT @EnrightsVar

```

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