%$&*! Spaces in column names!

  • I have a table where some column names include spaces. I don't like this because the program I'm writing to interface with the DB chokes on the spaces. I cannot change the table in any way either. Sooooo, how can I rename these columns between the table and my program?

    maybe a proc using the TABLE data-type?

    any ideas?

  • Build a view over the table and access the table from your program through the view.

     

  • This sounds like a good idea but how do I change [Column Name] to ColumnName?

    [Column Name] AS ColumnName?

  • Ok I got this. The view is setup and working now. Thanks for the help!

  • Great suggestion.  Old gaming trick... if you can't move, "change color".

    --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)

Viewing 5 posts - 1 through 4 (of 4 total)

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