IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[userfunc_747_jjgs_for_sql]') AND type = 'P')
DROP PROCEDURE [dbo].[userfunc_747_jjgs_for_sql]
GO
CREATE PROCEDURE userfunc_747_jjgs_for_sql(@cmpid int,   @branchid int,  @userdpid int,  @useruid int,   @userotid int,  @usersecurity int,@ctgid int,@ctgid2 int,@objid bigint,@param2 varchar(100))
as
begin


set nocount on 
declare @objtype varchar(20)='biz' 
declare @ordid bigint 
set @ordid=@objid 
declare @bizid int 
set @bizid = @ctgid 
declare @nonedate datetime 
set @nonedate = CONVERT(datetime,'1910-1-1')
declare @ord2group2 nvarchar(50) 
set @ord2group2 = '' 
declare @sys_recid bigint 
set @sys_recid = 0 


    select distinct ord_createdepart from order_265 where CHARINDEX('临',ord_no) = 0 and ord_branch=@param2 and ord_status = '返回到门店'



end