Resultset column width in Management Studio

sql, sql-server, sql-server-2005, ssms, t-sql

Solution

No, the width of each column is determined at runtime, and there is no way to override this in any version of Management Studio I've ever used. In fact I think the algorithm got worse in SQL Server 2008, and has been essentially the same ever since - you can run the same resultset twice, and the grid is inconsistent in the same output (this is SQL Server 2014 CTP2):

I reported this bug in 2008, and it was promptly closed as "Won't Fix":

- SSMS : Grid alignment, column width seems arbitrary (sorry, no link)

If you want control over this, you will either have to create an add-in for Management Studio that can manhandle the results grid, or you'll have to write your own query tool.

Update 2016-01-12: This grid misalignment issue should have been fixed in some build of Management Studio (well, the UserVoice item had been updated, but they admit it might still be imperfect, and I'm not seeing any evidence of a fix).

Update 2021-10-13: I updated this item in 2016 when Microsoft unplugged Connect and migrated some of the content to UserVoice. Now they have unplugged UserVoice as well, so I apologize the links above had to be removed, but this issue hasn't been fixed in the meantime anyway (just verified in SSMS 18.10).

Problem

Is there any way to alter the column width of a resultset in SQL Server 2005 Management Studio? I have a column which contains a sentence, which gets cut off although there is screen space. ``` | foo | foo2 | description | | foo | foo2 | description | |--------------------------| TO |----------------------------------| | x | yz | An Exampl.. | | x | yz | An Example sentence | ``` I would like to be able to set the column size via code so this change migrates to other SSMS instances with the code.

Original source