select distinct sql = 'alter table [' + onTable.name + '] drop constraint [' + foreignKey.name + ']' from sysforeignkeys fk inner join sysobjects foreignKey on foreignKey.id = fk.constid inner join sysobjects onTable on fk.fkeyid = onTable.id inner join sysobjects againstTable on fk.rkeyid = againstTable.id where 1=1 AND againstTable.TYPE = 'U' AND onTable.TYPE = 'U' order by 1