0

I assumed it would be fine to execute SQL ommand something like this

Installation' OR 'Software Repair'

This didn't work so well so I tried

This didn't go so great either, I got a missing expression for Data Recovery

This gave me a cannot validate SYS.CH_SERVICETYPE -check constraint violated

Does this mean this constraint is already in place? If not

How can I enforce a Check Constraint for a table to require only specific values?

Thanks

1 Answer 1

3

Use the IN keyword.

ServiceType in ('Training', 'Data_Recovery', 'Consultation', 'Software  Installation', 'Software Repair')
Sign up to request clarification or add additional context in comments.

3 Comments

Yeah I get cannot validate (SYS.CK_SERVICETYPE) - check constraint violated I guess this means that its already enforced ? Or there is like another constraint that is not allowing this to only = these values
That means, ServiceType column already has values other then what you have mentioned in the Constraint. Do a SELECT DISTINCT on ServiceType column to see what values it has.
Nah found it, had a _ in data type and a double space between Software and installation, it was case sensitive the current CK Thanks for the In statement, really helped out cheers!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.