IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[mps_update_role]') AND type = 'P')
DROP PROCEDURE [dbo].[mps_update_role]
GO

CREATE procedure [dbo].[mps_update_role]
@rl_value int,
@cmpid int ,
@rl_system int,
@rl_title varchar(100),
@rl_note varchar(500)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
update mps_role
set rl_system=case when @rl_system=-999999999 then rl_system  else @rl_system end,
rl_title=case when @rl_title='_none_' then rl_title  else @rl_title end,
rl_note=case when @rl_note='_none_' then rl_note  else @rl_note end
where rl_value=@rl_value and rl_cmpid=@cmpid 
END