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

Jim
  • 482
  • 1
  • 5
  • 20

1 Answers1

3

Use the IN keyword.

ServiceType in ('Training', 'Data_Recovery', 'Consultation', 'Software  Installation', 'Software Repair')
Noel
  • 10,152
  • 30
  • 45
  • 67
  • 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 – Jim May 13 '13 at 03:43
  • 1
    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. – Noel May 13 '13 at 03:54
  • 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! – Jim May 13 '13 at 03:59