|
Hello gentlemen,Ladies I have two tables Quantity and Purchases. When I purchase a product, first I have to check either it's old product or new. If it's Old means I have purchased before and its details already saved in the Database in Quantity Table so it will update the AvailableQuantity field only in the Quantity Table. Else if it's a new Product it must add new row in the Quantity Table with all details of the product. I hope it's clear for all I need your comment. How to do it with Trigger ( IF Exist Update else Insert ) or give me another solution.
(comments are locked)
|
|
Something like this. Use a procedure instead of a trigger
(comments are locked)
|


Which version of SQL Server are you dealing with? There are better options available in the newer versions.
you have to provide more information like table DDL, sample data and required result