Back to Browse

11. How to Update Data in SQL table using Stored Procedure

1.2K views
Mar 21, 2025
9:55

CREATE TABLE Production.ProductDetails ( ProductID INT PRIMARY KEY, Name NVARCHAR(100), Color NVARCHAR(50), ListPrice DECIMAL(10, 2) ); INSERT INTO Production.ProductDetails (ProductID, Name, Color, ListPrice) VALUES (701, 'Road Bike', 'Red', 650.00), (702, 'Mountain Bike', 'Blue', 750.00), (703, 'Helmet', 'Red', 150.00), (704, 'Gloves', 'Black', 10.00), (705, 'Jersey', 'Red', 130.00), (706, 'Road Bike Pro', 'Red', 1100.00), (707, 'Water Bottle', 'Green', 10.00); select * from Production.ProductDetails CREATE PROC Production.usp_udateListPrice @productid int, @listprice DECIMAL(10, 2) AS BEGIN UPDATE Production.ProductDetails SET ListPrice=@listprice WHERE ProductID=@productid END EXEC Production.usp_udateListPrice @PRODUCTID=704,@LISTPRICE=50.00

Download

1 formats

Video Formats

360pmp47.1 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

11. How to Update Data in SQL table using Stored Procedure | NatokHD