deferred constraint checking

前端 未结 1 566
孤独总比滥情好
孤独总比滥情好 2021-01-12 14:51

Currently In our database design we have an circular reference between two entities. In other words, we have foreign keys in each table that reference each others primary k

相关标签:
1条回答
  • 2021-01-12 15:40

    There is no native way to do deferred constraint checking in SQL Server.

    Likely your best option is to insert a NULL value into the foreign key column in the first table until the second record is inserted, and then as part of the same transaction, update the foreign key column in the first table.

    I'm interested - what is the business reason for your circular reference? It's definitely an extraordinary requirement.

    Also have a look at this thread, on the same topic.

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