If exists(select * from dbo.sysobjects where name='xxxx' and type='D')
ALTER TABLE xxxxxx
DROP CONSTRAINT DF_xxxxxxxALTER TABLE [dbo].[xxxxx] WITH NOCHECK ADD
CONSTRAINT [DF_xxxxxx] DEFAULT (xxxxx) FOR [xxxxx]
ALTER TABLE xxxxxx
DROP CONSTRAINT DF_xxxxxxxALTER TABLE [dbo].[xxxxx] WITH NOCHECK ADD
CONSTRAINT [DF_xxxxxx] DEFAULT (xxxxx) FOR [xxxxx]
if exists (select * from sysdepends where depid=object_id('AA') and id=object_id('BB'))
begin
alter table AA drop constraint BB
alter table dbo.AA add constraint CC 约束条件
end
ALTER TABLE [dbo].[AA] DROP CONSTRAINT BBALTER TABLE [dbo].[AA] ADD CONSTRAINT [CC] FOREIGN KEY