Codesmith practical skills (4): using extended attributes

Source: Internet
Author: User
Schemaexplorer Allow us to obtain information about some objects in the database. If you are using SQL Server2000 Database, you can get a lot of useful information about objects through extended attributes. For example: SQL Server An extended attribute is defined to identify the unique field in the table. You can write it in the template as follows: Identity Field =   <%   Foreach (Columnschema CS In Sourcetable. columns) {
If ((( Bool ) CS. extendedproperties [ " Cs_isidentity " ]. Value) =   True )
{
Response. Write (CS. Name );
}
}
%>

CodesmithDefined extended attributes includeTable columns, view columns,AndCommand Parameters.

Table Columns

Cs_isrowguidcol

Cs_isidentity

Cs_iscomputed

Cs_isdeterministic

Cs_identityseed

Cs_identityincrement

Cs_default

View Columns

Cs_iscomputed

Cs_isdeterministic

 Command Parameters

Cs_default

In addition, each object has Cs_description . You can also SQL Server System stored procedures in Sp_addextendedproperty To create custom extended attributes. For example, run the following command: Customer The ID Add a field Caption Extended attributes:

Sp_addextendedproperty ' Caption ' , ' Customer ID ' , ' User ' , DBO, ' Table ' , Customers, ' Column ' , ID

After executing this statement in the database, Codesmith Will be added to the extended attribute set of this field Caption Attribute. Related SQL Server For details about the extended attributes in, see books online.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.