sql >> データベース >  >> RDS >> Sqlserver

SQL Server 2008 でのテーブルの作成に関する SQL コメント

    これは私が使っているものです

    /*==============================================================*/
    /* Table: TABLE_1                                               */
    /*==============================================================*/
    create table TABLE_1 (
       ID                   int                  identity,
       COLUMN_1             varchar(10)          null,
       COLUMN_2             varchar(10)          null,
       constraint PK_TABLE_1 primary key nonclustered (ID)
    )
    go
    
    declare @CurrentUser sysname
    select @CurrentUser = user_name()
    execute sp_addextendedproperty 'MS_Description', 
       'This is my table comment',
       'user', @CurrentUser, 'table', 'TABLE_1'
    go
    
    declare @CurrentUser sysname
    select @CurrentUser = user_name()
    execute sp_addextendedproperty 'MS_Description', 
       'This is the primary key comment',
       'user', @CurrentUser, 'table', 'TABLE_1', 'column', 'ID'
    go
    
    declare @CurrentUser sysname
    select @CurrentUser = user_name()
    execute sp_addextendedproperty 'MS_Description', 
       'This is column one comment',
       'user', @CurrentUser, 'table', 'TABLE_1', 'column', 'COLUMN_1'
    go
    
    declare @CurrentUser sysname
    select @CurrentUser = user_name()
    execute sp_addextendedproperty 'MS_Description', 
       'This is column 2 comment',
       'user', @CurrentUser, 'table', 'TABLE_1', 'column', 'COLUMN_2'
    go
      

    1. ORACLE-ORA-01843:有効な月ではありません

    2. PHPとMySQL:月と日を動的な年と比較する

    3. mysql同じ主キーへのテーブル内の複数の外部キー

    4. 複数のデータソースを備えたTomcat6/7JNDI