Can anyone tell me how I can remove a foreign key in a SQL database?
Thanks in advanceDo you mean from the structure of the table, or from one of the data rows? Or remove the relationship entirely?
Don|||remove the relationship entirely.|||Two basic ways. If you have it, open SQL Server's Enterprise Manager and open or create a database diagram. Delete the relationship there.
With T-SQL, use the ALTER TABLE statement to drop the foreign key constraint, something like
ALTER TABLE tableName DROP CONSTRAINT foreignKeyConstraintName
You'll need the constraint name, which you can get from sp_helpconstraint.
Don|||Thanks
No comments:
Post a Comment