question

anumolus2 avatar image
anumolus2 asked

Is it possible to scan through selected tables in a database and find out the missing columns in those tables?

I am looking for a way to scan through all tables in a database (or) selected tables in a database and find out the missing values (either null or empty) in columns of those tables? Can someone please tell me if this is possible? If so, how will the query look like

sql-server-2012
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

borispinsky avatar image
borispinsky answered

Yep, You can do it with dynamic sql and INFORMATION_SCHEMA .

for example see the following post :

https://stackoverflow.com/questions/709120/how-to-search-for-one-value-in-any-column-of-any-table-inside-one-ms-sql-databas

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jon Crawford avatar image
Jon Crawford answered

that's not a high-value target though. there may be a lot of columns that make sense to have NULL/empty values (diagnosis codes, address2, secondaryphone or fax number, etc.). You'll be spending better time figuring out what fields cause problems by being null or empty, and then creating queries to find the blank spots in those columns.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.