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
Best Answer
Specify only the columns you want to see.
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.