如何编写MS SQL Server Management Studio中的列描述脚本?

时间:2019-07-09 12:12:06

标签: sql-server ssms azure-sql-server

我的 Azure SQL Server (版本12.0.1400)中有一个名为Assignment的表。

表本身以及大多数列均已填充Description。我已经使用SQL Server管理中的表设计器输入了这些Description值Studio(SSMS版本18.1 15.0.18131.0 )。

我的问题是,当我 script 表格时,我只看到表格Description,但看不到{{ 1}}列,在 Object Explorer 中清晰可见。

如果您看下面的屏幕截图,您会发现表Description以及列Assignment具有AssignmentId

enter image description here

当我编写表格脚本时,生成的SQL代码为:

Description

结果SQL脚本中唯一的/****** Object: Table [dbo].[Assignment] Script Date: 09-Jul-19 13:52:54 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[Assignment]( [AssignmentId] [varchar](255) NOT NULL, [HITId] [varchar](255) NOT NULL, [WorkerId] [varchar](255) NOT NULL, [HITStatus] [varchar](50) NOT NULL, [HITTitle] [varchar](1024) NULL, [HITTypeId] [varchar](1024) NULL, [HITGroupId] [varchar](1024) NULL, [HITCreationTime] [datetimeoffset](7) NULL, [Deadline] [datetimeoffset](7) NULL, [AcceptTime] [datetimeoffset](7) NULL, [SubmitTime] [datetimeoffset](7) NULL, [ApprovalTime] [datetimeoffset](7) NULL, [RejectionTime] [datetimeoffset](7) NULL, [AssignmentStatus] [varchar](10) NULL, [ImageUrl] [varchar](1024) NULL, [AnswerFreeText] [text] NULL, [SimpleCheckFinishedTime] [datetime2](7) NULL, [SimpleCheckStatus] [bit] NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO ALTER TABLE [dbo].[Assignment] WITH CHECK ADD CONSTRAINT [CK_Assignment_AssignmentStatus_Enumeration_Constraint] CHECK (([AssignmentStatus]='Rejected' OR [AssignmentStatus]='Approved' OR [AssignmentStatus]='Submitted')) GO ALTER TABLE [dbo].[Assignment] CHECK CONSTRAINT [CK_Assignment_AssignmentStatus_Enumeration_Constraint] GO ALTER TABLE [dbo].[Assignment] WITH CHECK ADD CONSTRAINT [CK_Assignment_HITStatus_Enumeration_Constraint] CHECK (([HITStatus]='Disposed' OR [HITStatus]='Reviewing' OR [HITStatus]='Reviewable' OR [HITStatus]='Unassignable' OR [HITStatus]='Assignable')) GO ALTER TABLE [dbo].[Assignment] CHECK CONSTRAINT [CK_Assignment_HITStatus_Enumeration_Constraint] GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'The Assignment data structure represents a single assignment of a HIT to a Worker. The assignment tracks the Worker''s efforts to complete the HIT, and contains the results for later retrieval. ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Assignment' GO 是用于表本身而不是用于列的脚本。

我还检查了对象资源管理器的选项:

enter image description here

但是我仍然无法在生成的SQL脚本中获得列的那些Description值。

如何使用SQL Server Management Studio中的脚本表提取它们?

0 个答案:

没有答案