Delete Records Using Stored Procedure In SQL 2008

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

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 Delete

Using stored procedure, we can delete records from a table by supplying parameters on the basis of which record is deleted.

Example

Before creating a Stored Procedure, we will create one table named Employee in the SQL database which looks as in the following image.

CreateTable-in-sqlserver.jpg

Now create stored procedure and add delete stored procedure to catalog.

Delete-StoredProcedure--in-SQL.jpg

Executing the sql delete stored procedure.

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

Output

Delete-SP-Output-in-SQL.jpg

© 2020 DotNetHeaven. All rights reserved.