TABLE Family(
BrothersName varchar(30)
);
I have added some names (values) into BrothersName, but now I want it to only have 2 specific names 'Alex' and 'Tom'. However later it should also accept other names. What is the best way to handle this problem?
Add a check constraint stating BrothersName should accept only 'Alex' and 'Tom'. In future when you don't need it you can drop the constraint
ALTER TABLE Family
ADD CONSTRAINT chk_BrothersName CHECK (BrothersName in ('Alex','Tom'))
To Drop the Check Constraint
ALTER TABLE Family
DROP CONSTRAINT chk_BrothersName
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With