添加列描述 [英] adding a column description

查看:28
本文介绍了添加列描述的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道如何通过运行脚本向 SQL Server 列添加描述?我知道您可以在使用 SQL Server Management Studio 创建列时添加说明.

Does anyone know how to add a description to a SQL Server column by running a script? I know you can add a description when you create the column using SQL Server Management Studio.

如何编写此脚本,以便在我的 SQL 脚本创建列时,还会添加该列的描述?

How can I script this so when my SQL scripts create the column, a description for the column is also added?

推荐答案

我认为您可能希望使用 sp_addextendedproperty 存储过程.

I'd say you will probably want to do it using the sp_addextendedproperty stored proc.

微软有一些很好的文档.

Microsoft has some good documentation on it.

试试这个:

EXEC sp_addextendedproperty 
    @name = N'MS_Description', @value = 'Hey, here is my description!',
    @level0type = N'Schema',   @level0name = 'yourschema',
    @level1type = N'Table',    @level1name = 'YourTable',
    @level2type = N'Column',   @level2name = 'yourColumn';
GO

这篇关于添加列描述的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆