troubleshooting Question

MSSQL 2019 Select * [Except .'x','y','z']

Avatar of Scott Fell
Scott FellFlag for United States of America asked on
Microsoft SQL ServerSQL
4 Comments1 Solution21 ViewsLast Modified:
Is it possible to have a Select all query except a couple of specific fields?  

My use case is to return all fields from MyTable except two specific fields. The table can have some new fields added to it and my goal is to not hard code the select statement when the table layout changes. 
SELECT * FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'MyTable'
I know my options could include pushing out to a temp table and removing those two fields from the temp table for viewing, or saving the data to an array and pop the two elements.  My question is if there is a way to do this as an SQL statement and perhaps 2019 has something obscure?
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros