Please let me know how to fix this error. How does the CHECK OPTION work in TRANSACTION mode?
Here is my scenario,
1. Say booking_number in table B is defined as foreign key which is the primary key of table A.
2. In my stored procedure, the same booking record is inserted into A and then B.
3. There is no error if the stored procedure is called without TRANSACTION mode.
4. There is also no error if the stored procedure is called with TRANSACTION mode and the foreign key was defined as "WITH NO CHECK OPTION"
5. The error only happens in TRANSACTION mode and the foreign key is defined as "WITH CHECK OPTION". It looks like in TRANSACTION mode, the booking_number was not considered already inserted into A so the CHECK failed while the booking_number is being inserted into B.
Thanks!
Forums: