Click here to Skip to main content
15,883,749 members
Articles / Desktop Programming / Win32

SQL Class Shell Generator

Rate me:
Please Sign up or sign in to vote.
4.87/5 (65 votes)
8 Jan 2009CPOL6 min read 218.1K   3.3K   233  
Generate class shells from SQL Server database tables, (SQL 2005 & 2008 only). Output languages supported: C# and VB.NET.
��<HTML><HEAD>

<META NAME="COPYRIGHT" CONTENT="2008 � Paw Jershauge">

<META NAME="DESCRIPTION" CONTENT="This site contains information about the SQLReader  Class Library.">

<META NAME="AUTHOR" CONTENT="Paw Jershauge">

<META NAME="CODING" CONTENT="Paw Jershauge">

<META NAME="DEVELOPER" CONTENT="Paw Jershauge [http://paw.jershauge.dk]">

<META NAME="GENERATOR" CONTENT="Assembly To HTML by Paw Jershauge">

<LINK REL="STYLESHEET" TYPE="TEXT/CSS" HREF="../dat/msdn2.css"></LINK><SCRIPT LANGUAGE="Javascript1.2" SRC="../dat/jscr.js"></SCRIPT>

<TITLE>SQLReader by Paw Jershauge</TITLE></HEAD><BODY CLASS="typeclass" onunload="wo('../toolbar.htm','TOOLBAR');CurrentObject('...');">

<P CLASS="medium"><IMG SRC="../img/minus.gif" WIDTH="16" HEIGHT="16" BORDER="0" CLASS="midmgR" ID="collapse_expandimg" NAME="collapse_expandimg"><A NAME="collapse_expand" href="#collapse_expand" onclick="plusminustglcontentshowing();tglContent();" CLASS="liketext">Collapse/Expand content</A></P>

SQLReader  Class Library

<H1>DefaultConstraint Public Class</H1>

<P><B>Namespace:</B> <A HREF="SQLReader.htm">SQLReader</A></P>

<P><B>Assembly:</B> <A HREF="SQLReader(1.0.0.0).htm">SQLReader</A> ( in SQLReader.dll )</P>

<P><B>Basetype(s): </B><A HREF="SQLReader.AbstractSQLObject.htm" TARGET="_self">SQLReader.AbstractSQLObject</A></P>

<H3>In this document the following highlight are available:</H3>

<UL><LI><A HREF="#ANAME_PropertyBox">Properties (18)</A></LI><LI><A HREF="#ANAME_SeeAlso_RefBox">See also</A></LI></UL><A NAME="ANAME_PropertyBox"></A><H2 CLASS="clk" onclick="plusminustgl('PropertyBox');"><IMG SRC="../img/minus.gif" WIDTH="16" HEIGHT="16" BORDER="0" CLASS="midmgR" ID="PropertyBoxImg" NAME="PropertyBoxImg">Properties</H2>

<TABLE CELLPADDING="0" CELLSPACING="0" BORDER="0" WIDTH="100%" ID="PropertyBox" NAME="PropertyBox"><TR><TD CLASS="tdhead">&nbsp;</TD><TD CLASS="tdhead">Name</TD><TD CLASS="tdhead">Type</TD><TD CLASS="tdhead">Description</TD></TR>

<TR><TD CLASS="tditemimg"><IMG SRC="../objimg/Properties.png" WIDTH="16" HEIGHT="16" BORDER="0" CLASS="mid" TITLE="Public Property"></TD><TD CLASS="tditem" nowrap>create_date</TD><TD CLASS="tditem"><A HREF="http://msdn2.microsoft.com/en-us/library/System.DateTime.aspx" TARGET="_blank" CLASS="aRef">DateTime</A></TD><TD CLASS="tditem">Date the object was created&nbsp;</TD></TR>

<TR><TD CLASS="tditemimg"><IMG SRC="../objimg/Properties.png" WIDTH="16" HEIGHT="16" BORDER="0" CLASS="mid" TITLE="Public Property"></TD><TD CLASS="tditem" nowrap>definition</TD><TD CLASS="tditem"><A HREF="http://msdn2.microsoft.com/en-us/library/System.String.aspx" TARGET="_blank" CLASS="aRef">String</A></TD><TD CLASS="tditem">SQL expression that defines this default.

SQL Server 2005 differs from SQL Server 2000 in the way it decodes and stores SQL expressions in the catalog metadata. The semantics of the decoded expression are equivalent to the original text; however, there are no syntactic guarantees. For example, white spaces are removed from the decoded expression. For more information, see, Behavior Changes to Database Engine Features in SQL Server 2005 [ http://msdn.microsoft.com/en-us/library/ms143359(printer).aspx ]&nbsp;</TD></TR>

<TR><TD CLASS="tditemimg"><IMG SRC="../objimg/Properties.png" WIDTH="16" HEIGHT="16" BORDER="0" CLASS="mid" TITLE="Public Property"></TD><TD CLASS="tditem" nowrap>is_ms_shipped</TD><TD CLASS="tditem"><A HREF="http://msdn2.microsoft.com/en-us/library/System.Boolean.aspx" TARGET="_blank" CLASS="aRef">Boolean</A></TD><TD CLASS="tditem">Object is created by an internal SQL Server component&nbsp;</TD></TR>

<TR><TD CLASS="tditemimg"><IMG SRC="../objimg/Properties.png" WIDTH="16" HEIGHT="16" BORDER="0" CLASS="mid" TITLE="Public Property"></TD><TD CLASS="tditem" nowrap>is_published</TD><TD CLASS="tditem"><A HREF="http://msdn2.microsoft.com/en-us/library/System.Boolean.aspx" TARGET="_blank" CLASS="aRef">Boolean</A></TD><TD CLASS="tditem">Object is published&nbsp;</TD></TR>

<TR><TD CLASS="tditemimg"><IMG SRC="../objimg/Properties.png" WIDTH="16" HEIGHT="16" BORDER="0" CLASS="mid" TITLE="Public Property"></TD><TD CLASS="tditem" nowrap>is_schema_published</TD><TD CLASS="tditem"><A HREF="http://msdn2.microsoft.com/en-us/library/System.Boolean.aspx" TARGET="_blank" CLASS="aRef">Boolean</A></TD><TD CLASS="tditem">Only the schema of the object is published&nbsp;</TD></TR>

<TR><TD CLASS="tditemimg"><IMG SRC="../objimg/Properties.png" WIDTH="16" HEIGHT="16" BORDER="0" CLASS="mid" TITLE="Public Property"></TD><TD CLASS="tditem" nowrap>is_system_named</TD><TD CLASS="tditem"><A HREF="http://msdn2.microsoft.com/en-us/library/System.Boolean.aspx" TARGET="_blank" CLASS="aRef">Boolean</A></TD><TD CLASS="tditem">1 = Name was generated by system.
0 = Name was supplied by the user&nbsp;</TD></TR>

<TR><TD CLASS="tditemimg"><IMG SRC="../objimg/Properties.png" WIDTH="16" HEIGHT="16" BORDER="0" CLASS="mid" TITLE="Public Property"></TD><TD CLASS="tditem" nowrap>modify_date</TD><TD CLASS="tditem"><A HREF="http://msdn2.microsoft.com/en-us/library/System.DateTime.aspx" TARGET="_blank" CLASS="aRef">DateTime</A></TD><TD CLASS="tditem">Date the object was last modified by using an ALTER statement. If the object is a table or a view, modify_date also changes when a clustered index on the table or view is created or altered&nbsp;</TD></TR>

<TR><TD CLASS="tditemimg"><IMG SRC="../objimg/Properties.png" WIDTH="16" HEIGHT="16" BORDER="0" CLASS="mid" TITLE="Public Property"></TD><TD CLASS="tditem" nowrap>name</TD><TD CLASS="tditem"><A HREF="http://msdn2.microsoft.com/en-us/library/System.String.aspx" TARGET="_blank" CLASS="aRef">String</A></TD><TD CLASS="tditem">Object name.&nbsp;</TD></TR>

<TR><TD CLASS="tditemimg"><IMG SRC="../objimg/Properties.png" WIDTH="16" HEIGHT="16" BORDER="0" CLASS="mid" TITLE="Public Property"></TD><TD CLASS="tditem" nowrap>object_id</TD><TD CLASS="tditem"><A HREF="http://msdn2.microsoft.com/en-us/library/System.Int32.aspx" TARGET="_blank" CLASS="aRef">Int32</A></TD><TD CLASS="tditem">Object identification number. Is unique within a database.&nbsp;</TD></TR>

<TR><TD CLASS="tditemimg"><IMG SRC="../objimg/Properties.png" WIDTH="16" HEIGHT="16" BORDER="0" CLASS="mid" TITLE="Public Virtual Property"></TD><TD CLASS="tditem" nowrap>ObjectName</TD><TD CLASS="tditem"><A HREF="http://msdn2.microsoft.com/en-us/library/System.String.aspx" TARGET="_blank" CLASS="aRef">String</A></TD><TD CLASS="tditem">&nbsp;</TD></TR>

<TR><TD CLASS="tditemimg"><IMG SRC="../objimg/Properties.png" WIDTH="16" HEIGHT="16" BORDER="0" CLASS="mid" TITLE="Public Property"></TD><TD CLASS="tditem" nowrap>Owner</TD><TD CLASS="tditem"><A HREF="SQLReader.DefaultConstraints.htm" TARGET="_self" CLASS="aRef">DefaultConstraints</A></TD><TD CLASS="tditem">&nbsp;</TD></TR>

<TR><TD CLASS="tditemimg"><IMG SRC="../objimg/Properties.png" WIDTH="16" HEIGHT="16" BORDER="0" CLASS="mid" TITLE="Public Property"></TD><TD CLASS="tditem" nowrap>parent_column_id</TD><TD CLASS="tditem"><A HREF="http://msdn2.microsoft.com/en-us/library/System.Int32.aspx" TARGET="_blank" CLASS="aRef">Int32</A></TD><TD CLASS="tditem">ID of the column in parent_object_id to which this default belongs&nbsp;</TD></TR>

<TR><TD CLASS="tditemimg"><IMG SRC="../objimg/Properties.png" WIDTH="16" HEIGHT="16" BORDER="0" CLASS="mid" TITLE="Public Property"></TD><TD CLASS="tditem" nowrap>parent_object_id</TD><TD CLASS="tditem"><A HREF="http://msdn2.microsoft.com/en-us/library/System.Int32.aspx" TARGET="_blank" CLASS="aRef">Int32</A></TD><TD CLASS="tditem">ID of the object to which this object belongs.
0 = Not a child object&nbsp;</TD></TR>

<TR><TD CLASS="tditemimg"><IMG SRC="../objimg/Properties.png" WIDTH="16" HEIGHT="16" BORDER="0" CLASS="mid" TITLE="Public Property"></TD><TD CLASS="tditem" nowrap>principal_id</TD><TD CLASS="tditem"><A HREF="http://msdn2.microsoft.com/en-us/library/System.Int32.aspx" TARGET="_blank" CLASS="aRef">Int32</A></TD><TD CLASS="tditem">ID of the individual owner, if different from the schema owner. By default, schema-contained objects are owned by the schema owner. However, an alternate owner can be specified by using the ALTER AUTHORIZATION statement to change ownership.
Is NULL if there is no alternate individual owner.
Is NULL if the object type is one of the following:
C = CHECK constraint
D = DEFAULT (constraint or stand-alone)
F = FOREIGN KEY constraint
PK = PRIMARY KEY constraint
R = Rule (old-style, stand-alone)
TA = Assembly (CLR-integration) trigger
TR = SQL trigger
UQ = UNIQUE constrain&nbsp;</TD></TR>

<TR><TD CLASS="tditemimg"><IMG SRC="../objimg/Properties.png" WIDTH="16" HEIGHT="16" BORDER="0" CLASS="mid" TITLE="Public Property"></TD><TD CLASS="tditem" nowrap>schema_id</TD><TD CLASS="tditem"><A HREF="http://msdn2.microsoft.com/en-us/library/System.Int32.aspx" TARGET="_blank" CLASS="aRef">Int32</A></TD><TD CLASS="tditem">ID of the schema that the object is contained in.
For all schema-scoped system objects that ship with SQL Server 2005, this value will always be
IN (schema_id('sys'), schema_id('INFORMATION_SCHEMA'))&nbsp;</TD></TR>

<TR><TD CLASS="tditemimg"><IMG SRC="../objimg/Properties.png" WIDTH="16" HEIGHT="16" BORDER="0" CLASS="mid" TITLE="Public Property"></TD><TD CLASS="tditem" nowrap>type</TD><TD CLASS="tditem"><A HREF="http://msdn2.microsoft.com/en-us/library/System.String.aspx" TARGET="_blank" CLASS="aRef">String</A></TD><TD CLASS="tditem">Object type:
AF = Aggregate function (CLR)
C = CHECK constraint
D = DEFAULT (constraint or stand-alone)
F = FOREIGN KEY constraint
PK = PRIMARY KEY constraint
P = SQL stored procedure
PC = Assembly (CLR) stored procedure
FN = SQL scalar function
FS = Assembly (CLR) scalar function
FT = Assembly (CLR) table-valued function
R = Rule (old-style, stand-alone)
RF = Replication-filter-procedure
S = System base table
SN = Synonym
SQ = Service queue
TA = Assembly (CLR) DML trigger
TR = SQL DML trigger
IF = SQL inline table-valued function
TF = SQL table-valued-function
U = Table (user-defined)
UQ = UNIQUE constraint
V = View
X = Extended stored procedure
IT = Internal tabl&nbsp;</TD></TR>

<TR><TD CLASS="tditemimg"><IMG SRC="../objimg/Properties.png" WIDTH="16" HEIGHT="16" BORDER="0" CLASS="mid" TITLE="Public Property"></TD><TD CLASS="tditem" nowrap>type_desc</TD><TD CLASS="tditem"><A HREF="http://msdn2.microsoft.com/en-us/library/System.String.aspx" TARGET="_blank" CLASS="aRef">String</A></TD><TD CLASS="tditem">Description of the object type.
AGGREGATE_FUNCTION
CHECK_CONSTRAINT
DEFAULT_CONSTRAINT
FOREIGN_KEY_CONSTRAINT
PRIMARY_KEY_CONSTRAINT
SQL_STORED_PROCEDURE
CLR_STORED_PROCEDURE
SQL_SCALAR_FUNCTION
CLR_SCALAR_FUNCTION
CLR_TABLE_VALUED_FUNCTION
RULE
REPLICATION_FILTER_PROCEDURE
SYSTEM_TABLE
SYNONYM
SERVICE_QUEUE
CLR_TRIGGER
SQL_TRIGGER
SQL_INLINE_TABLE_VALUED_FUNCTION
SQL_TABLE_VALUED_FUNCTION
USER_TABLE
UNIQUE_CONSTRAINT
VIEW
EXTENDED_STORED_PROCEDURE
INTERNAL_TABL&nbsp;</TD></TR>

<TR><TD CLASS="tditemimg"><IMG SRC="../objimg/Properties.png" WIDTH="16" HEIGHT="16" BORDER="0" CLASS="mid" TITLE="Public Virtual Property"></TD><TD CLASS="tditem" nowrap>UniqueObjectName</TD><TD CLASS="tditem"><A HREF="http://msdn2.microsoft.com/en-us/library/System.String.aspx" TARGET="_blank" CLASS="aRef">String</A></TD><TD CLASS="tditem">&nbsp;</TD></TR>

</TABLE>

<H2 CLASS="clk" onclick="plusminustgl('SeeAlso_RefBox');"><IMG SRC="../img/minus.gif" WIDTH="16" HEIGHT="16" BORDER="0" CLASS="midmgR" ID="SeeAlso_RefBoxImg" NAME="SeeAlso_RefBoxImg">See Also:</H2>

<A NAME="ANAME_SeeAlso_RefBox"></A><DIV ID="SeeAlso_RefBox" NAME="SeeAlso_RefBox">

&bull; <A HREF="SQLReader.AbstractSQLObject.htm" TARGET="_self">SQLReader.AbstractSQLObject</A>

<SPAN>&bull; <A HREF="SQLReader.DefaultConstraints.htm" TARGET="_self">DefaultConstraints</A></SPAN>&nbsp;&nbsp;



</DIV>

<SCRIPT LANGUAGE="Javascript1.2">

parent.MENU.ShDiv('SQLReader(1.0.0.0)_Assembly');

parent.MENU.ShDiv('SQLReader.SQLReader_Namespace');

parent.MENU.ShDiv('SQLReader.SQLReader_Class');

parent.MENU.location=parent.MENU.location + '#SQLReader_SQLReader.DefaultConstraint';

CopyRight('Copyright � Paw Jershauge 2008');

CurrentObject('DefaultConstraint Class');

</SCRIPT>

</BODY></HTML>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

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


Written By
Software Developer
Denmark Denmark

Comments and Discussions