Aarti Bhardwaj
Aarti Bhardwaj

Reputation: 21

SQL/MySQL - Skip or no select a column from select query

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

Answers (1)

mkRabbani
mkRabbani

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

Related Questions