--添加"紧急状态"字段 use [GUOYOUZI.Study] go IF(NOT EXISTS(SELECT 1 FROM sys.tables t JOIN sys.columns c ON c.object_id = t.object_id WHERE t.name='BasicInfo' AND c.name='EmergencyState')) BEGIN alter table [dbo].BasicInfo add EmergencyState tinyint; declare @CurrentUser sysname select @CurrentUser = user_name() execute sp_addextendedproperty 'MS_Description', '紧急状态', 'user', @CurrentUser, 'table', 'BasicInfo', 'column', 'EmergencyState' end
![](https://img2024.cnblogs.com/blog/35695/202408/35695-20240825082459112-376424429.jpg)