SQL standard See table statement

Source: Internet
Author: User

Build a table

/******************************************************************************** cell master record, to ensure synchronization with Orglevelunit * * * * ****************************************************************************/

IF NOT EXISTS (SELECT object_name (ID)From sysobjectsWHERE xtype =Uand OBJECTPROPERTY (Id' ismsshipped ') =0and object_name (ID) =' Wyestate ')CreateTable Wyestate (IdvarcharPrimary)KeyNotNull--Cell code, Auto code, a+4 digits, allow handwritingNamevarchar200)Null--Cell name FloorareaDecimal10,2),--Floor Area BuiltareaDecimal10,2),--Construction Area GreenareaDecimal10,2),--Green area RoadareaDecimal10,2),--Road area BuildingnumIntNotNullDefault0),--Address of building numbernvarchar2000),--Cell address Leadervarchar50),--director Leadernamevarchar100),--Owner's name Developernvarchar200),--Developer Devcontractornvarchar200),--Developer Contact person Devcontractwaynvarchar400),--Developer Contact information Remarknvarchar4000),--Remark StduservarcharNot   null, Builder varchar (builddate) is not  null,--Created by datetime default (  GETDATE ()) not null,--creation time Laster varchar () not  null,--Last modified by person Lastdate DateTime Default (getdate ()) not null --Last modified time)       
Add a table field
    if not exists (    select * from  syscolumns     where id =  object_id(‘WYEstate‘) and name = ‘MSQuestion‘ ) alter table WYEstate add MSQuestion NVARCHAR(500) null--问题
Delete a table field
    if exists (    select * from  syscolumns     where id =  object_id(‘WYEstate‘) and name = ‘MSQuestion‘ ) alter table WYEstate drop column MSQuestion--问题
Add a comment to a table field
    EXEC sys.sp_addextendedproperty @name=N‘MS_Description‘, @value=N‘问题‘ , @level0type=N‘SCHEMA‘,@level0name=N‘dbo‘, @level1type=N‘TABLE‘,@level1name=N‘WYEstate‘, @level2type=N‘COLUMN‘,@level2name=N‘MSQuestion‘

SQL standard See table statement

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.