Reputation: 21
I want to exclude a column from select query. In this approach, i have to mention all the fields name except that i don't want. Is there any other approach?
SELECT column_1, column_2, column_3,
/* ...the list of columns 4-97, not shown in this example... */,
column_98, column_99
FROM table
Upvotes: 0
Views: 86
Reputation: 16918
Try this. As far as I remember, I got this solution from SO years back :)
SELECT * INTO #TMP FROM your_table
ALTER TABLE #TMP DROP COLUMN column_name
SELECT * FROM #TMP
--DROP TABLE #TMP WHEN PURPOSE IS DONE
Upvotes: 1