Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resultset column width in Management Studio

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.

like image 415
Jamie Stuart Robin Parsons Avatar asked Nov 21 '13 15:11

Jamie Stuart Robin Parsons


People also ask

What is column width in SQL?

Default Display A NUMBER column's width equals the width of the heading or the width of the FORMAT plus one space for the sign, whichever is greater. If you do not explicitly use FORMAT, then the column's width will always be at least the value of SET NUMWIDTH.

How do I zoom in SSMS result window?

From the SSMS Tools menu, choose Options. Then in the search box type 'FON', choose 'Font and Colors' and from the drop down list labeled 'Show settings for : ' choose 'Grid Results'. Enlarge the font size. Restart SSMS and your view will be much better.

How do I change the width of SQL Server?

Using SQL Server Management StudioExpand Databases, right-click the database to increase, and then click Properties. In Database Properties, select the Files page. To increase the size of an existing file, increase the value in the Initial Size (MB) column for the file.


1 Answers

What you can do is alias the selected field like this:

SELECT name as [name        .] FROM ... 

The spaces and the dot will expand the column width.

like image 149
Anonymous Coward Avatar answered Oct 09 '22 17:10

Anonymous Coward