4>
5> CREATE PROCEDURE spDeleteProduct @Productid int
6> AS
7> BEGIN TRY
8> BEGIN TRANSACTION
9> DELETE Product WHERE ProductID = @ID
10> COMMIT TRANSACTION
11> END TRY
12> BEGIN CATCH
13> DECLARE @Err AS int
14> DECLARE @Msg AS varchar(max)
15> SET @Err = @@Error
16> SET @Msg = Error_Message()
17> ROLLBACK TRANSACTION
18> INSERT ErrorTable
19> VALUES (@err, @msg)
20> END CATCH
21> GO
1>
2>
3> drop PROCEDURE spProduct_Delete;
4> GO
1>
2>
3> drop table Product;
4> GO
|