SELECT (* - some_columns) FROM TABLE in SQL

I have a table with many columns, among which I would like to omit a few in my "select" query. Something like that select (* - columns_to_be_omitted) from myTable. Is there any way to do this other than listing all the other columns in the query?

This is a one-time manual request, so I'm not worried about performance. Ease of use is a big need here.

+3
source share
5 answers

You cannot do this - it is best to use a tool such as SQL Prompt if you are using SQL Server Management Studio.

SQL Prompt SELECT * FROM MyTable, "*" , SQL Prompt , , . , , SELECT.

, SSMS : - (

+2

SQL. , , ( ), SQL .

, ( , ). MySQL .

+4

, M $ IDE , intellisense... , 2008 , 2005 .

SQL Management Studio, script select to new query, , . .

:)

+1

. , select, temprory, .

0

You can dynamically build a list of columns using a query on a data dictionary. Then you can add a list of unwanted columns to where-clause (e.g. column name not in ()). (Not sure how you could do this using the proc stored method that cletus suggested.)

0
source

Source: https://habr.com/ru/post/1722655/


All Articles