欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

SqlServer增加字段及字段描述信息SQL脚本

程序员文章站 2022-08-18 09:38:36
-- 代开药信息 alter table MI_Register add HelpMedicineFlag smallint DEFAULT (0), HelpMedicineName varchar(50) null, IDType varchar(10) null, HelpMedicineIDNO varchar(18) nullgoIF ((SELECT COUNT(*) from fn_listextendedproperty('MS_Description', 'SC....
-- 代开药信息 
alter table MI_Register add
  HelpMedicineFlag smallint DEFAULT (0),
  HelpMedicineName varchar(50) null,
  IDType varchar(10) null,
  HelpMedicineIDNO varchar(18) null
go

IF ((SELECT COUNT(*) from fn_listextendedproperty('MS_Description', 
'SCHEMA', N'dbo', 
'TABLE', N'MI_Register', 
'COLUMN', N'HelpMedicineFlag')) > 0) 
EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'代开药标识:0非代开药处方;1代开药处方'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'MI_Register'
, @level2type = 'COLUMN', @level2name = N'HelpMedicineFlag'
ELSE
EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'代开药标识:0非代开药处方;1代开药处方'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'MI_Register'
, @level2type = 'COLUMN', @level2name = N'HelpMedicineFlag'
GO

IF ((SELECT COUNT(*) from fn_listextendedproperty('MS_Description', 
'SCHEMA', N'dbo', 
'TABLE', N'MI_Register', 
'COLUMN', N'HelpMedicineName')) > 0) 
EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'代开药人员姓名'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'MI_Register'
, @level2type = 'COLUMN', @level2name = N'HelpMedicineName'
ELSE
EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'代开药人员姓名'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'MI_Register'
, @level2type = 'COLUMN', @level2name = N'HelpMedicineName'
GO

 

本文地址:https://blog.csdn.net/Pei_hua100/article/details/110630547

相关标签: DB