IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[mps_save_label]') AND type = 'P')
DROP PROCEDURE [dbo].[mps_save_label]
GO
CREATE procedure [dbo].[mps_save_label]
@lbcid int ,
@lbc_category nvarchar(50),
@lbc_group nvarchar(50),
@lbc_name nvarchar(50),
@lbc_flag int ,
@lbc_sql nvarchar(4000),
@lbc_pickvalues nvarchar(4000),
@lbc_browse int
as
begin
update mps_label_config set 
lbc_category = case when @lbc_category='_none_' then lbc_category else @lbc_category end ,
lbc_group = case when @lbc_group='_none_' then lbc_group else @lbc_group end ,
lbc_name = case when @lbc_name='_none_' then lbc_name else @lbc_name end ,
lbc_flag = case when @lbc_flag=-999999999 then lbc_flag else @lbc_flag end ,
        lbc_browse = case when @lbc_browse=-999999999 then lbc_browse else @lbc_browse end ,
lbc_sql = case when @lbc_sql='_none_' then lbc_sql else @lbc_sql end ,
lbc_pickvalues = case when @lbc_pickvalues='_none_' then lbc_pickvalues else @lbc_pickvalues end  
WHERE lbc_id=@lbcid 
end