7

Help, not all of my column is displaying in the output of the query!

 2 years ago
source link: https://www.sqlservercentral.com/blogs/help-not-all-of-my-column-is-displaying-in-the-output-of-the-query
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Help, not all of my column is displaying in the output of the query!

Kenneth Fisher, 2022-02-22

I’ll be honest, I don’t remember if I’ve written about this before but I couldn’t find it, so here we go.

Have you ever run a query and not all of your output is displaying?

CREATE TABLE #test (col1 varchar(100));
INSERT INTO #test VALUES ('1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30');
SELECT * FROM #test;
DROP TABLE #test;

Or text output:

If you guessed there is a setting for this you’re right! Under Tools -> Options.

I’m showing the default values for the number of characters to output. I.e. 256 in text and 65535 in grid. Obviously I reduced this for my demo (down to 30 characters for each, which is the minimum). In general though I recommend increasing them to the maximum which is 2097152 characters in both text and grid output. That way if you want less you can handle that in the query itself. I.e. SELECT LEFT(Col1,30). To make this easy I just put 999999999 and it auto reduces to the maximum.

And the last thing I’ll mention here is that if for some reason you need to change these (or any number of other) settings for a specific query window you can go to the Query menu or right click in the query pane and then go to Query Options.

Original post (opens in new tab)
View comments in original post (opens in new tab)


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK