troubleshooting Question

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

Avatar of Scott Fell
Scott FellFlag for United States of America asked on
SQLMicrosoft SQL Server
4 Comments3 Solutions24 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. 

Open in new window

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 our community to see this answer!
Unlock 3 Answers and 4 Comments.
Start Free Trial
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 3 Answers 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