Click here to Skip to main content
15,663,033 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello. I want to write a SQL script to get information about a database's tables, columns of each tables and the data stored in each row x col without knowing anything about a database beforehand. The program will only get the server and database name from me and the rest will be automated process. Is this possible using either INFORMATION_SCHEMA or Catalog Views? Any further pointers? Thanks in advance.

1 solution

Certenly. Administrative views and helper stored procedures can tell anything about the database schema and data you have. And as you can run dynamic sql you can even do semantic analysis.
But there are ready-made tools for this you can use / or consult.
Share this answer
YourAverageCoder 5-Sep-14 10:03am    
May i ask where can i find those tools?
Zoltán Zörgő 5-Sep-14 13:48pm    
Well, it depends what kind of analysis you need. For example, if you generate database schema from within SQL Management Studio, it is using those information to generate the DDL script.
I don't know which language you intend to use for your tool, but you might find this library interesting:
YourAverageCoder 6-Sep-14 1:33am    
Much appreciated.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900