Solved

MS SQL Server database schema retrieval

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Query Producing decimal places when it shouldn;t be 8 42
Best resource to learn entity framework 2 32
Hey!! 5 33
Hey!!!! 1 20
Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

816 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now