declare @dropSQL nvarchar(max)
set @dropSQL=N''
select distinct @dropSQL=@dropSQL+'ALTER TABLE dbo.'+table_name+' DROP CONSTRAINT '+constraint_name+';'
from INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE

EXEC dbo.sp_executesql @dropSQL
GO
declare @dropSQL nvarchar(max)

set @dropSQL=N''

select distinct @dropSQL=@dropSQL+'DROP INDEX '+name+' ON dbo.'+object_name(object_id)+';'
from sys.indexes
where name is not null and object_name(object_id)
in (select distinct table_name from LIVEDB.information_schema.columns 
 )
EXEC dbo.sp_executesql @dropSQL

相关文章:

  • 2022-03-06
  • 2022-12-23
  • 2021-12-21
  • 2022-01-09
  • 2022-12-23
  • 2021-11-07
  • 2021-10-16
  • 2022-12-23
猜你喜欢
  • 2021-09-25
  • 2021-12-10
  • 2021-07-09
  • 2022-02-16
  • 2021-12-31
  • 2021-10-12
  • 2022-03-05
相关资源
相似解决方案