Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

SQL count used columns

Posted on 2009-07-09
5
Medium Priority
?
272 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 1500 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

618 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