select (column1+column2) AS column1, table1.*
from table1

both column1 and column2 are columns in table1. Is there anyway that when I run the query I can get only the new column1 is shown and the old one is ignored?

My current option is spell out every column in the table that I actually do want to show up

Edit: This is with SQL 2008 R2, but I'd be interested if other SQL versions have a solution as well


1 Answer 1


Specify only the columns you want to see.

select (column1+column2) AS column1,
from table1

It is bad form to use table1.*, as your SQL code will be vulnerable to changes in the table structure. It is a good habit to always specify the exact columns you want.

  • An easy way to get this is use the SSMS object explorer to select top 1000. You can now comment or delete as necessary or simply copy all columns to your code.
    – Dave
    Nov 12, 2015 at 21:07
  • 1
    An even easier way is to locate the table in the Object Explorer pain, then click-and-drag the "Columns" header over to the query window in SSMS. That gives you a great comma-delimited list of all the columns in the table.
    – Hannah Vernon
    Nov 12, 2015 at 22:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.