IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[mps_g_1branch_departtitle]') AND type = 'P')
DROP PROCEDURE [dbo].[mps_g_1branch_departtitle]
GO
CREATE procedure [dbo].[mps_g_1branch_departtitle](
@cmpid int,
@mybcid int 
)
as 
begin
-- 返回部门岗位n
set nocount on
select dp_id , ot_id , dp_fullname+'/'+ot_title  dp_fullname 
from mps_depart ,  mps_depart_title , mps_title 
where dp_cmpid=@cmpid and dp_bcid=@mybcid and dt_dpid=dp_id and dt_otid=ot_id and dp_fullname>'' and ot_title>'' and dp_isdepart=0
order by   dp_order ,dp_level, ot_order , ot_level 
set nocount off
end