Go to home page mail me! RSS Feed

Get schema information from SQL Server

Tuesday, January 08, 2008 9:35 AM

Database access layers (DAL) are still archaic and hard to design and develop, for the .Net developer there are tons of ways to design a DAL. As for me, I got fed up a few years ago and basically used generators to generate the layer for me and as time passes by I needed something more custom to my style of coding, so I developed my own custom DAL generator. Anyway, to cut a long story very short, SQL server has advanced forward, so I have to keep updating the generator every now and then, mainly because there are simpler ways of doing things. For example the SqlConnection.GetSchema allows you to get a list of cool stuff  "schema information". Here are a few ways in which it can be used.

SqlConnection.GetSchema() - returns all the metadata that is available and its restrictions.

SqlConnection.GetSchema("ReservedWords") - returns a list of reserved words for that specific database engine.

SqlConnection.GetSchema("MetaDataCollections") - returns the list of metadata collections, which is usually the same as GetSchema().

SqlConnection.GetSchema("Restrictions") - returns a list of restrictions

SqlConnection.GetSchema("Views") - returns a list of views

SqlConnection.GetSchema("Tables") - returns a list of tables

Your Comments.

No comments posted yet.

Your Reply.

Comment Form.

Fields denoted with a "*" are required.

You may also like to leave your email or website.

 
Please add 2 and 6 and type the answer here:

Preview Your Comment.

 
Next entries »