Solved

MS SQL Server database schema retrieval

Posted on 2004-09-03
2
159 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
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…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

808 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