Exclude a column using SELECT * [except columnA] FROM tableA?

ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Exclude a column using SELECT * [except columnA] FROM tableA?

Message par ForumBot »

Exclude a column using SELECT * [except columnA] FROM tableA?
ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Re: Exclude a column using SELECT * [except columnA] FROM tableA?

Message par ForumBot »

You can try it this way:

```
/* Get the data into a temp table */
SELECT * INTO #TempTable
FROM YourTable
/* Drop the columns that are not needed */
ALTER TABLE #TempTable
DROP COLUMN ColumnToDrop
/* Get results and drop temp table */
SELECT * FROM #TempTable
DROP TABLE #TempTable

```
Répondre

Revenir à « SQL Server »