(Using AdventureWorks2012 database)
Create a procedure to update the product with a new name in Production.Product table for a given product id only if cost of product cost is greater than 100
CREATE PROCEDURE USP_PRODUCTRENAME(@NAME NVARCHAR(50), @PRODUCTID INT, @STANDARDCOST NUMERIC)
AS
BEGIN
UPDATE Production.Product
SET Name = @NAME
WHERE ProductID = 515
AND StandardCost >= 100;
END;
This is how i use stored procedure for product name update.
Can someone help me to Implement the same scenario through trigger function ?