IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[sys_Sql_getval_spkey]') AND type = 'P')
DROP PROCEDURE [dbo].[sys_Sql_getval_spkey]
GO
--特殊表关键值获取：depart,company,branch
--非java调用存储过程，@dpid,@bcid,@cpid，需要根据@useruid获得
create procedure [dbo].[sys_Sql_getval_spkey](
@parseid int,
@proctype varchar(50),
@preblank varchar(100),
@script varchar(4000) output
)as
begin
select @script=''
if (@proctype='java')
return

if (exists(select * from flatDSS where parseid=@parseid and (shortname='depart' or shortname='branch')))
select @script = @preblank + 'select @bcid=cu_bcid,@dpid=cu_dpid  from mps_employee where cu_id=@useruid ' + char(13)

end