Save template file as xxxxx.sqldoc

Adding extended note to database table…

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Used as identity field' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'tblTableName', @level2type=N'COLUMN',@level2name=N'colCol01'

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'The tblTableName table description' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'tblTableName'

EXEC sys.sp_addextendedproperty N'MS_Description', N'The primary key for this table is Col01', 'SCHEMA', N'dbo', 'TABLE', N'tblTableName', 'CONSTRAINT', N'PK_tblTableName'
EXEC sp_addextendedproperty N'MS_Description', N'This is the description for the table.', 'SCHEMA', N'dbo', 'TABLE', N'tblTable01', NULL, NULL
GO
EXEC sp_addextendedproperty N'MS_Description', N'This is the description for the column.', 'SCHEMA', N'dbo', 'TABLE', N'tblTable01', 'COLUMN', N'col01'
GO
-- Add extended properties for TABLE
EXEC sys.sp_addextendedproperty 
@name=N'MS_Description', 
@value=N'This is the description for the table.' ,
@level0type=N'SCHEMA', 
@level0name=N'dbo', --Schema Name
@level1type=N'TABLE', 
@level1name=N'tbImageReviewStaging'--Table Name 
GO

-- Add extended properties for COLUMN
EXEC sys.sp_addextendedproperty 
@name=N'MS_Description', 
@value=N'This is the description for the column.' ,
@level0type=N'SCHEMA', 
@level0name=N'dbo', --Schema Name
@level1type=N'TABLE', 
@level1name=N'tblTable01', --Table Name 
@level2type=N'COLUMN', 
@level2name=N'col01' --Column Name
GO

Important: Remember to use “MS_Description” instead of “Description”.

Last modified: February 27, 2020

Author

Comments

Write a Reply or Comment