Solved

MS SQL Server database schema retrieval

Posted on 2004-09-03
2
160 Views
Last Modified: 2010-07-27
I would like to retrieve the database schema and determine the following:

  * User Tables
  * Keys (primary keys, composite keys, no keys)
  * Relationships (all types)
  * Null possible

I am really desperate to retrieve this information and will award maximum points for solution.

Can someone please provide an example of how to retrieve the schema and the above information.

Cheers.
0
Comment
Question by:smacca
2 Comments
 
LVL 22

Accepted Solution

by:
Mohammed Nasman earned 500 total points
ID: 11970927
Hello

  Here are few articles to help you for doing that

Retrieving Schema Information Using ADO.NET and C#
http://www.c-sharpcorner.com/Code/2004/July/OledbSchema.asp

Browsing MS SQL Server Desktop Engine using Information Schema
http://www.codeproject.com/cs/database/MSDEInfoSchema.asp

Retrieve Table Metadata
http://www.ftponline.com/vsm/2003_01/magazine/columns/databasedesign/

HTH
0
 
LVL 9

Expert Comment

by:glsac
ID: 11983020
SqlConnection cn = new SqlConnection("PutYourConnectionStringOverHere");
SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM Information_Schema.Tables where Table_Type = 'BASE TABLE'", cn");
DataTable dt = new DataTable();
da.Fill(dt);
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

Suggested Solutions

Title # Comments Views Activity
bound data table problem 2 40
abstract class C# 1 35
Where does legacy ASP.NET initialize language? 2 55
ASP.NET - Why is accordion not working? 3 44
Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

685 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