sql如何判断表字段是否存在默认值

if exists(SELECT  1
            FROM    sys.tables t
                    INNER JOIN sys.columns c ON t.object_id = c.object_id
                    INNER JOIN sys.default_constraints dc ON c.default_object_id = dc.object_id
            WHERE   t.name '你的表名称'
                    AND c.name '你的列名称')
    存在默认值约束的处理
else
    不存在默认值约束的处理
posted @ 2018-09-27 17:07  风无心客  阅读(1884)  评论(0编辑  收藏  举报