sql server 添加字段并且赋默认值和说明

时间:2021-01-23 05:44:55

select soct.Captcha,CreateOn,* from SceneryOrderCheckTicket soct
right join
(
SELECT Captcha,convert(char(10),CreateOn,120) as createdate FROM dbo.SceneryOrderCheckTicket
where CreateOn>'2014-01-01' and Ord in(1,2,3,4)
group by Captcha,convert(char(10),CreateOn,120)
HAVING COUNT (Captcha)>1 ) ss on soct.Captcha=ss.Captcha
where CreateOn>'2014-01-01' and Ord in(1,2,3,4)
order by soct.Captcha

alter table MonthEnd_Unit
  add MEU_IsImport bit null default(0)
go

EXEC sys.sp_addextendedproperty @name=N'MS_Description',
@value=N'是否是导入的月结' , @level0type=N'SCHEMA',@level0name=N'dbo',
@level1type=N'TABLE',@level1name=N'MonthEnd_Unit',
@level2type=N'COLUMN',@level2name=N'MEU_IsImport'
go