sql server - What logic error do I have in this SQL check constraint? -


I spent the last night trying to find out what is wrong in the below check barrier. I want to apply the following rule:

  • All the rows are blank
  • or call 1 is not empty and only one of the other columns is not zero (if Call is 4 set, it must be set to true)

I am able to insert rows only with call 1 set, but I want an error in return. Add table test table (call 1 varchar (10) faucet, cola varchar (10) tap, call 3 varchar (10) null, call 4 bit, tap) Obstacle x check ((call 1 is blank and call 2 is empty and call 3 is empty and call 4 is not empty) or (call1 is not empty and (call 2 is not zero and call 3 is empty and call 4 empty ) Or (call 2 is empty and call 3 is not empty and call 4 is not empty) or (call 2 is empty and call 3 is empty and Col4 = 1)))

does not work with parallelism N: ULLs:

  Changing the table Add X check in the test box ((Call 1 is blank and Call 2 is empty and call 3 is empty and call 4 is empty) or (call 1 is not zero and ((call 2 is not zero and call 3 is empty and call 4 is empty) or (call 2 is empty and call 3 Is not empty and call 4 is empty) or (call 2 is empty and call 3 is empty and (call 4 is not empty and Col4 = 1)))  

Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

lua - HowTo create a fuel bar -