IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[order_184_g_relation]') AND type = 'P')
DROP PROCEDURE [dbo].[order_184_g_relation]
GO
CREATE  procedure order_184_g_relation(@ordid bigint, @useruid int ) as beginset nocount on select ord_id,ord_bizid,ord_bcid,ord_branch,ord_cmpid,ord_createcuid,ord_createdepart,ord_createdpid,ord_creator,ord_date,ord_key,ord_no,ord_status,ord_title,ord_type,ord_updated,ord_dpid,ord_cuid,ord_depart,ord_empname , @useruid ordp_cuid from order_184 where ord_id=@ordid union allselect ord_id,ord_bizid,ord_bcid,ord_branch,ord_cmpid,ord_createcuid,ord_createdepart,ord_createdpid,ord_creator,ord_date,ord_key,ord_no,ord_status,ord_title,ord_type,ord_updated,ord_dpid,ord_cuid,ord_depart,ord_empname,isnull(ordp_cuid,0) ordp_cuid from order_183 inner join order_184_relation on ordr_rordid=ord_id and ordr_ordid=@ordid and ordr_rcrmid=183 LEFT OUTER JOIN order_183_users on ordp_ordid=ord_id and ordp_type='bizview' and ordp_cuid=@useruid order by ord_date set nocount off end