How do you change the width of a displayed column?

  • Hopefully a simple answer..

    How do you change the width of a displayed column when you do a query...so I can fir it on the screen.

    In Oracle you would so it like this col column_name format a25

    thanks

  • You can double click on the column edge to resize it as seen in this screenshot.

    Pradeep Adiga
    Blog: sqldbadiaries.com
    Twitter: @pradeepadiga

  • Thanks for the reply.

    Its actually for a Morning Check that I want SQL Mail to email to me. The column for the database_name is far too wide. Its read from a system table so changing the column width of this is not an option.

    thanks

  • You can make use of -W switch in sqlcmd utility to remove the trailing space.

    Pradeep Adiga
    Blog: sqldbadiaries.com
    Twitter: @pradeepadiga

  • C3PO-594572 (1/5/2011)


    SQL Server is so inferior to Oracle its unbelievable!

    Funny, I was going to say the same thing about Oracle. 😉 It can't even return a result set directly to a GUI. :hehe:

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • C3PO-594572 (1/5/2011)


    SQL Server is so inferior to Oracle its unbelievable!

    Spam. Reported. (Not because of the message. Because of the signature. ;-))



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • C3PO-594572 (1/4/2011)


    Hopefully a simple answer..

    How do you change the width of a displayed column when you do a query...so I can fir it on the screen.

    In Oracle you would so it like this col column_name format a25

    thanks

    How about

    select CAST(ColAWidthPossible150Chars as varchar(25)) as newcolof25chars

    will truncate the rest but will display a lenght of 25 chars on screen..

    and so will only mail the width of 25 chars in this case..

    Wkr,

    Eddy

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply