/*==========================================================================================
**
** FILE : ProcDeleteAdmin_Tb.sql
** Author:Stevan Rodrigues
**
**==========================================================================================
**
** (c) The contents of this file , and of any file or document derived from it , are copyright
** to Site Builders . Unlicensed alteration, change or copying in any form,
** whether written, by photocopy, by print or by any other methods of reproduction is
** strictly prohibited.
**
**==========================================================================================
**
** PURPOSE OF FILE :
**
** DETAILED DESCRIPTION OF FUNCTIONALITY
** LIST OF PARAMETERS USED
@AdminId int,
@DeletedDate datetime,
@EditUsername varchar(25)
**
** LIST OF RETURN VALUES AND THEIR DEFINITIONS
** 0 : Successful
**=========================================================================================*/
if exists( select * from sysobjects where id = object_id(N'[dbo].[ProcDeleteAdmin_Tb]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop Proc [dbo].[ProcDeleteAdmin_Tb]
go
create procedure ProcDeleteAdmin_Tb
@AdminId int,
@DeletedDate datetime,
@EditUsername varchar(25)
as
set nocount on
Declare @ErrorNumber int,
@RowCount int,
@CountRec int,
@EditAdminId int,
@TableName varchar(50),
@PrimaryId int,
@Action varchar(15),
@ActionDate datetime
Delete from Admin_Tb
where AdminId = @AdminId
-- error checking
select @ErrorNumber = @@error,
@RowCount = @@rowcount
if ( @ErrorNumber <> 0 )
begin
/*exec ErrorHandler @ErrorNumber, 'Admin_Tb', 'adding'*/
set nocount off
return 1
end
select @PrimaryId = @AdminId
select @EditAdminId = AdminId from Admin_Tb
where Username = @EditUsername
select @TableName = 'Admin_Tb'
select @Action = 'Delete'
select @ActionDate = @deletedDate
exec ProcAddRecordAction_Tb @EditAdminId, @TableName, @PrimaryId, @Action, @ActionDate
set nocount off
return 0
go