I'm working for a client to import data out of a generic off the shelf application database. If you can imagine a database that is designed by software developers that have no concept of database design, that is what i'm dealing with. I'm selecting from tables that have 50+ columns, where half the columns contain null data for every row (i.e. not used). My question is, how do i identify the columns that are null for EVERY row (i.e. useless) and exclude them from my queries? Thanks for your help! (i want to avoid going column by column saying isnull etc. as that will take forever!)
Sql-server – SQL Server select columns which contain data
sql servert-sql
Related Question
- T-sql – Finding keywords in SQL script
- Sql-server – SQL Server: Covering indexes including all columns
- Sql-server – Computed Columns – SQL Server Function
- Sql-server – Best way to choose which columns to index to improve performance
- Sql-server – Get every column in database that contains only Null records
Best Answer
You can use this stored procedure to the trick You need to provide the table name you wish to query note that if you'll pass to procedure the @exec parameter = 1 it will execute the select query