﻿DECLARE @sql nvarchar(max) = ''

SELECT @sql += 'DROP INDEX ' + uk.name + ' ON ' + tbl.name + ';' + CHAR(13) + CHAR(10) 
FROM sys.indexes uk 
INNER JOIN sys.tables tbl ON tbl.object_id = uk.object_id
WHERE uk.is_unique = 1 AND uk.name like 'UK%' AND tbl.name like 'T[_]%'

EXEC sp_executesql @sql
GO

DECLARE @sql nvarchar(max) = ''

SELECT @sql +=  'ALTER TABLE ' + tb.name + ' DROP CONSTRAINT ' + fk.name + ';' +  CHAR(13) + CHAR(10) 
FROM sys.foreign_keys fk
INNER JOIN sys.tables tb ON tb.object_id = fk.parent_object_id
WHERE fk.name like 'FK[_][0-9]%' OR fk.name like 'FK[_]T[_][0-9]%'

EXEC sp_executesql @sql
GO
