SQL Update Stored Procedure - Update Stored Procedure in SQL Server
UPDATE Stored Procedure
- ALTER PROCEDURE using UPDATE
Demo wikitechydatabase
- Below is a selection from the wikitechytable table used in the examples:
Example
- ALTER PROCEDURE using Update
ALTER PROCEDURE GetDataSP ( @id INTEGER @name VARCHAR(10), @course VARCHAR(10), @fees INTEGER, @StatementType NVARCHAR(20) = '' ) AS BEGIN BEGIN IF @StatementType = 'Update' UPDATE wikitechytable SET (id = @id, name = @name, course = @coure, fees = @fees) WHERE id = @id END END
Output
Execute PROCEDURE using UPDATE
EXEC GetDataSP @id=102, @name='Ajay', @course = 'SQL' , @fees=200, @StatementType = 'Update' ;