Home > database >  The Merge in a table at the same time, new table update how to play?
The Merge in a table at the same time, new table update how to play?

Time:12-12

Table 1, the name="zhang SAN" records into a "bill";
Table 2, a new record="elementary school"} {school,

Two tables it doesn't matter, no constraint, who can Merge to do two things, a word I learn, thank you.

CodePudding user response:

This is common sense demand?

CodePudding user response:

Can't, the MERGE of the target table is only one,

If both mandatory should agree to complete, the transaction should be used, similar to the following:
 BEGIN TRY 
The BEGIN TRAN
- to do
COMMIT TRAN.
END the TRY
The BEGIN CATCH
The ROLLBACK TRAN.
The SELECT ERROR_MESSAGE () AS MSG;
END the CATCH


  • Related