SQL Server: drop a FK constraint, which is not foreign key

前端 未结 2 544
再見小時候
再見小時候 2021-01-21 04:36

I am using SQL Server 2008 and its Management Studio. I am doing a web project, which has a tool to automate the tables/relationships creation.

My web project reveals t

相关标签:
2条回答
  • 2021-01-21 04:48

    You can try

     sp_help [table_name]
    

    to get all the foreign key constraints.

    When you get the foreign key constraints on the table. Drop them by writing something like this:-

    ALTER TABLE [dbo].[table_name] DROP CONSTRAINT [Foreign_FK]
    
    0 讨论(0)
  • 2021-01-21 04:55

    There is no such constraint!

    The first error clearly says that it could NOT create that constraint since the datatypes of those two columns involved (Game.Id and Tester.Game) do not match.

    What you should do is check how you're creating your FK constraint that leads to that first error - and explicitly give that FK constraint a meaningful name!

    0 讨论(0)
提交回复
热议问题