generate column list

  • There must be a simple way to do this...

    I want to convert a series of statements of the form "select * from tbl" into statements of the form

    "select col_1, col_2, ... from tbl"

    Any solution will do (editor trick or script etc.), as I don't have that many to deal with. However, I really would like to avoid all of the typing and the mistakes that come with it!

    Thanks

    Shane

  • Expand out object explorer, click in 'Columns' of the table, drag that to the query window.

    I know RedGate's SQLPrompt expands out *, but it's not free.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Expand out object explorer, click in 'Columns' of the table, drag that to the query window.

    I know RedGate's SQLPrompt expands out *, but it's not free.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Expand out object explorer, click in 'Columns' of the table, drag that to the query window.

    I know RedGate's SQLPrompt expands out *, but it's not free.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Highlight the table name in your query window, hit ALT-F1, click the gray Column_Name heading in the second recordset, and use CTRL-C and CTRL-V to cut and paste the column names into your query.

  • Thanks Gail that should do fine.

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

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