Solved

SQL count used columns

Posted on 2009-07-09
5
246 Views
Last Modified: 2012-05-07
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!
0
Comment
Question by:ALSO_DB
  • 3
  • 2
5 Comments
 
LVL 57

Expert Comment

by:Raja Jegan R
ID: 24811575
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..
0
 

Author Comment

by:ALSO_DB
ID: 24811592
I would like to see which columns are used and which are unused.....
0
 
LVL 57

Accepted Solution

by:
Raja Jegan R earned 500 total points
ID: 24811639
>> I would like to see which columns are used and which are unused.....

Kindly tell me what's the criteria to identify whether they are used or unused so that I can try to help you out.
0
 

Author Comment

by:ALSO_DB
ID: 24811691
If the column is filled with data --> the colum is used
if the column is empty --> the column is unused
0
 
LVL 57

Expert Comment

by:Raja Jegan R
ID: 24811731
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.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question