IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[mps_query_conditions]') AND type = 'P')
DROP PROCEDURE [dbo].[mps_query_conditions]
GO
create procedure [dbo].[mps_query_conditions]( 
@cmpid int , 
@branchid int , 
@bizid int ,
@useradmin int ,
@userdpstid int,
@userdpid int ,
@userotid int
) as
begin 
set nocount on
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
create table #pobj(ctgid int) 

insert into #pobj exec [mps_biztype_query_authority] @cmpid,@branchid,@bizid,@useradmin,@userdpstid,@userdpid,@userotid

select bql_id,bql_group,bql_caption from mps_biztype_query with(nolock),#pobj 
where bql_bizid=@bizid and bql_status=0 and bql_id=ctgid

set nocount off 
end