Does anyone know if you can drop a constraint on a table via a linked server in SQL 2005
Asked
Active
Viewed 383 times
2 Answers
1
Can you have a Foreign Key onto a View of a Linked Server table in SQLServer 2k5?
I would say you can not.
1
You can, but you have to use some dynamic SQL trickery to make it happen.
declare @cmd VARCHAR(4000)
SET @cmd = 'Use YourDatabase
ALTER TABLE YourTable
DROP CONSTRAINT YourConstraint'
exec YourServer.master.dbo.sp_executesql @SQL

mrdenny
- 4,990
- 2
- 21
- 28
-
Very late but this is genious, Finally found what I needed – Jorge Guzman Jun 04 '12 at 19:20