Can there be constraints with the same name in a DB?

后端 未结 6 1268
逝去的感伤
逝去的感伤 2020-12-10 00:39

This is a follow-on question from the one I asked here.

Can constraints in a DB have the same name?

Say I have:

CREATE TABLE Employer
(
    E         


        
6条回答
  •  隐瞒了意图╮
    2020-12-10 00:59

    The other answers are all good but I thought I'd add an answer to the question in the title, i.e., "can there be constraints with the same name in a DB?"

    The answer for MS SQL Server is yes – but only so long as the constraints are in different schemas. Constraint names must be unique within a schema.

提交回复
热议问题