Stored Procedures [dbo].[DELETE_UND_USER]
Properties
PropertyValue
ANSI Nulls OnYes
Quoted Identifier OnYes
Parameters
NameData TypeMax Length (Bytes)
@user_id_1bigint8
@modified_by_2bigint8
Permissions
TypeActionOwning Principal
GrantExecuteuniadmin
GrantExecuteuniuser
SQL Script
/****** Object:  Stored Procedure dbo.DELETE_UND_USER    Script Date: 12/1/2005 11:50:08 PM ******/

/****** Object:  Stored Procedure DELETE_UND_USER    Script Date: 3/25/2005 2:24:50 PM ******/
CREATE PROCEDURE [DELETE_UND_USER]
    (@user_id_1     [bigint],
     @modified_by_2     [bigint])

AS

DECLARE @liRecCount integer

SELECT @liRecCount  = ( SELECT count(*)  from und_job where [user_id] = @user_id_1 )

IF @liRecCount > 0
BEGIN
    -- Need to update the task table
    -- Need to add the status column to the und_user table
    -- Need to handle this as a transactional unit
    UPDATE und_job
    SET [status] = 'deleted', dt_last_modified = getdate()
    WHERE
        ( [user_id]     = @user_id_1 )
END
ELSE
BEGIN
    DELETE [srdb].[und_user]

    WHERE
        ( [user_id]     = @user_id_1 AND
         [modified_by]     = @modified_by_2)
END
GO
GRANT EXECUTE ON  [dbo].[DELETE_UND_USER] TO [uniadmin]
GRANT EXECUTE ON  [dbo].[DELETE_UND_USER] TO [uniuser]
GO
Uses