Update Records Using Stored Procedure In SQL 2008

In this article i will explain how to update records in table with the help of Parameterized Stored Procedure.
  • 1816

Introduction

Parameterized Stored Procedure

These accept one or more Parameters. It is important that data type of parameters should be same as the data type in tables.

Parameterized Stored Procedure for Update

Using Stored Procedure we can update records in table. Following example explains , how to update records using parameterized stored procedure.

Example

Suppose we have table named Employee as.

CreateTable-in-sqlserver.jpg

Suppose, I want to update salary of "Amit Kumar" to 40000. To do this, create  stored procedure for update

Update-SP-Output-in-SQL.jpg

Execute Stored Procedure.

Execute-sp-for-update-in-sql.jpg

After executing the above query the salary of "Amit Kumar" will be updated to 40000 in the table.

Update-StoredProcedure-Output-in-SQL.jpg

© 2013 dotNetheaven. All rights reserved.