--添加设备使用者字段
alter table [DeviceInfo] add UsingUserId int not null default (0) ;
--添加说明
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'设备使用者' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'DeviceInfo', @level2type=N'COLUMN',@level2name=N'UsingUserId'
GO
--修改表的列名
exec sp_rename '[dbo].[PhoneCallLog].[IsPhoneCallOut]','CallType' ;
--删除原始约束
ALTER TABLE [dbo].[PhoneCallLog] DROP CONSTRAINT [DF__PhoneCall__IsPho__05664177];
--修改字段类型
alter table PhoneCallLog alter column CallType int not null ;
--修改字段默认值 (添加新约束)
alter table PhoneCallLog add default (0) for CallType with values;
--修改原始字段值为新的值 (将原来的呼入状态旧值 0 改为新的值 2 )
update [dbo].[PhoneCallLog] set CallType=2 where CallType=0