zoukankan      html  css  js  c++  java
  • 添加或者更新字段说明

    --添加或者更新字段说明
    ALTER PROC [dbo].[AddOrUpdateColnumComment]
        (
          @tableName sysname ,
          @colnumName sysname ,
          @comment NVARCHAR(50)
        )
    AS ;
        IF EXISTS ( SELECT  *
                    FROM    dbo.syscolumns a
                            LEFT JOIN dbo.systypes b ON a.xusertype = b.xusertype
                            INNER JOIN dbo.sysobjects d ON a.id = d.id
                                                           AND d.xtype = 'U'
                                                           AND d.name <> 'dtproperties'
                            LEFT JOIN dbo.syscomments e ON a.cdefault = e.id
                            LEFT JOIN sys.extended_properties g ON a.id = g.major_id
                                                                  AND a.colid = g.minor_id
                            LEFT JOIN sys.extended_properties f ON d.id = f.major_id
                                                                  AND f.minor_id = 0
                    WHERE   d.name = @tableName
                            AND a.name = @colnumName
                            AND g.value IS NOT NULL )
            BEGIN
                EXECUTE sys.sp_updateextendedproperty N'MS_Description', @comment,
                    N'SCHEMA', N'dbo', N'TABLE', @tableName, N'COLUMN',
                    @colnumName; 
            END;
                
        ELSE
            BEGIN
                EXEC sp_addextendedproperty 'MS_Description', @comment, 'user',
                    dbo, 'table', @tableName, 'column', @colnumName;
            END;

  • 相关阅读:
    334 Increasing Triplet Subsequence 递增的三元子序列
    332 Reconstruct Itinerary 重建行程单
    331 Verify Preorder Serialization of a Binary Tree 验证二叉树的前序序列化
    330 Patching Array
    329 Longest Increasing Path in a Matrix 矩阵中的最长递增路径
    328 Odd Even Linked List 奇偶链表
    327 Count of Range Sum 区间和计数
    326 Power of Three 3的幂
    Java中的Class.forName
    巧用Java中Calendar工具类
  • 原文地址:https://www.cnblogs.com/apollokk/p/6713812.html
Copyright © 2011-2022 走看看