Link to home
Start Free TrialLog in
Avatar of ALSO_DB
ALSO_DB

asked on

SQL count used columns

hi there
I want a SQL statement with which i get all views with more than 230 columns AND which shows me which of these columns are explicit used.

any help would be appreciated!
Avatar of Raja Jegan R
Raja Jegan R
Flag of India image

This would help you fetch table names with more than 230 columns.

SELECT table_name
FROM information_schema.columns
GROUP BY table_name
HAVING count(*) > 230

Kindly explain me what you meant by explicit used..
Avatar of ALSO_DB
ALSO_DB

ASKER

I would like to see which columns are used and which are unused.....
ASKER CERTIFIED SOLUTION
Avatar of Raja Jegan R
Raja Jegan R
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ALSO_DB

ASKER

If the column is filled with data --> the colum is used
if the column is empty --> the column is unused
Then you have to use a procedure to loop through all tables and find what are all the list of columns that are used and unused depending upon whether data is present in that table or not.

Can you kindly elaborate on your requirement so that I can think of some other possibilities.