1. Forum Rules (PLEASE CLICK HERE TO READ BEFORE POSTING) Click the link to access ADSM.ORG Acceptable Use Policy and forum rules which should be observed when using this website. Violators may be banned from this website. This message will disappear after you have made at least 12 posts. Thank you for your cooperation.

SQL - Adding a blank column

Discussion in 'Scripting' started by GregE, Aug 22, 2007.

  1. GregE

    GregE Senior Member

    Joined:
    May 12, 2006
    Messages:
    2,100
    Likes Received:
    31
    Just a cosmetic question.

    Is there a way in SQL to add a blank column? Using Operational Reporting, I get a text email with two columns, but they're very close together.

    My command is:
    select node_name, sum(physical_mb) as TOTAL_MB from occupancy group by node_name order by 2 desc

    Running from TSM command line the spacing is fine, but in the text email the columns are close.

    Thanks!
     
  2.  
  3. heada

    heada Moderator

    Joined:
    Sep 23, 2002
    Messages:
    2,560
    Likes Received:
    168
    Occupation:
    Storage Administrator
    Location:
    Indiana
    Add underscores to the column header "Total_MB" "__Total_MB__"

    This will force TSM to use a wider column size.

    -Aaron
     
  4. GregE

    GregE Senior Member

    Joined:
    May 12, 2006
    Messages:
    2,100
    Likes Received:
    31
    That expanded the header, but since the column is left-justified it didn't separate any differently. Is there a way to set that column to right-justify?
     
  5. mateinone

    mateinone Moderator

    Joined:
    Nov 21, 2005
    Messages:
    537
    Likes Received:
    2
    Occupation:
    TSM Specialist
    Location:
    Victoria, Australia
    yeap... use the right command.

    You can also use _'s as Aaron has stated or just blank spaces to expand a column width

    You could also add a ' ' in between the commands.
     
  6. GregE

    GregE Senior Member

    Joined:
    May 12, 2006
    Messages:
    2,100
    Likes Received:
    31
    I didn't know I could do this, but just tried it. Very nice. Quick example of use if anyone needs to know. Use || to concatenate with something else, in this case a string of blanks. This will expand the column.

    SELECT n.node_name||'<insert spaces>' as NODE, n.platform_name as PLATFORM FROM nodes n.....
    ......etc etc.
     

Share This Page