What is the T-SQL syntax to exclude a duplicate column in the output when joining 2 tables?

Viewed 167

I am using SQL Server 2014 and I have the following T-SQL query which joins 2 tables:

SELECT a.*, b.* FROM TEMP a

INNER JOIN Extras b ON b.ResaID = a.ResaID

I would like to pull ALL the columns from TEMP and all the columns from "Extras" with the exception of the ResaID column as it is already included in a.* in the above query. Basically, I want to pull a.* + b.* (excluding b.ResaID).

I know I can write the query in the form:

Select a.*, b.column2, b.column3,... 

but since b.* has got around 40 columns, is there a way to write the query in a more simplified way to exclude b.ResaID, rather than specify each of the columns in the "Extras" table?

3 Answers
Related