Jim
Jim

Reputation: 482

Creating a check constraint for multiple specific inputs

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

Upvotes: 0

Views: 190

Answers (1)

Noel
Noel

Reputation: 10525

Use the IN keyword.

ServiceType in ('Training', 'Data_Recovery', 'Consultation', 'Software  Installation', 'Software Repair')

Upvotes: 3

Related Questions