简体   繁体   中英

Deleting a constraint that has not been named?

I know how to delete a constraint but what about deleting a constraint that has not been named.

Here I have used a Check constraint without name.

Example:

create table customers
(
 id int not null,
  name varchar(50) not null,
  age int not null check (age>=18),
  [Address] char(50),
  salary decimal(18,2),  
   primary key (id)
    );

I tried using following command

 alter table customers drop check (age)

But, it gives incorrect syntax error.

Is there a simple way to drop a constraint that is not name?

i found someone who have the same problem and solved it !

Take a look here :>

How to drop SQL default constraint without knowing its name?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM