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

CREATE procedure [dbo].[mps_save_biztype_1] 
@bql_id int,
@bql_caption nvarchar(100),
@bql_sql nvarchar(4000),
@bql_orderby nvarchar(4000),
@bql_status int ,
@bql_order int ,
@bql_group nvarchar(100) 
 as
begin

  update mps_biztype_query set 
bql_group  = case when @bql_group='_none_' then bql_group else @bql_group end ,
bql_caption  = case when @bql_caption='_none_' then bql_caption else @bql_caption end ,
    bql_sql  = case when @bql_sql='_none_' then bql_sql else @bql_sql end ,
    bql_orderby   = case when  @bql_orderby='_none_' then bql_orderby else @bql_orderby end ,
    bql_status   = case when  @bql_status=-999999999 then bql_status else @bql_status end  ,
    bql_order   = case when  @bql_order=-999999999 then bql_order else @bql_order end  
  where bql_id=@bql_id    
   
end