Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MERGE Syntax
Message
From
18/01/2017 19:29:14
 
 
To
18/01/2017 12:46:35
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Environment versions
SQL Server:
SQL Server 2012
Miscellaneous
Thread ID:
01646827
Message ID:
01646837
Views:
47
If I can make a suggestion - you might want to considering adding this, in addition to the JOIN between Inserted and Deleted
WHERE D.iQty <> i.IQty
(and you might even need to account for NULL values as well)

Reason for this - if the trigger fires even though a quantity wasn't changed (i.e. old value and new value are the same), the MERGE doesn't need to occur.

Also -just curious, why use a MERGE when you're only performing an UPDATE?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform