Drop Foreign Key without knowing the name of the constraint?

后端 未结 7 1168
遇见更好的自我
遇见更好的自我 2020-12-15 03:59

I have created one table using below command:

create table Table1(
    Id int Not Null 
        Foreign key 
        references Table2(Id)  
        on delet         


        
7条回答
  •  误落风尘
    2020-12-15 04:42

    You can find the name of the constraint in INFORMATION_SCHEMA.TABLE_CONSTRAINTS

    select CONSTRAINT_NAME
    from INFORMATION_SCHEMA.TABLE_CONSTRAINTS
    where TABLE_NAME = 'Table1'
    

提交回复
热议问题