declare @tab varchar(50),@forkey varchar(50),@sql varchar(200),@int int,@i int
select @int=count(*) from sys.foreign_keys
set @i=1
while @i <= @int
begin
select top 1 @tab=o.name,@forkey=fk.name from sys.foreign_keys fk
JOIN sys.all_objects o ON (fk.parent_object_id=o.object_id)
order by o.name
set @sql='alter table ' + @tab + ' drop constraint ' + @forkey
select @sql
exec(@sql);
set @i = @i + 1
end