SQL Delete Stored Procedure - Delete Stored Procedure in SQL Server



DELETE Stored Procedure

  • ALTER PROCEDURE using DELETE

Demo wikitechydatabase

  • Below is a selection from the wikitechytable table used in the examples:
delete-procedure-table

Example

  • ALTER PROCEDURE using Delete
ALTER PROCEDURE GetDataSP
(
@id INTEGER
@StatementType NVARCHAR(20) = ''
)
AS
BEGIN
  BEGIN
      IF @StatementType = 'Delete'
          DELETE wikitechytable FROM
          WHERE id = @id
  END
END

Output

delete-stored-procedure

Execute PROCEDURE using DELETE

EXEC GetDataSP @id=101, @StatementType = 'Delete' ;

Output

call-delete-stored-procedure


Related Searches to SQL Delete Stored Procedure - Delete Stored Procedure in SQL Server