IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[mps_gen_bizmodify0]') AND type = 'P')
DROP PROCEDURE [dbo].[mps_gen_bizmodify0]
GO
create procedure [dbo].[mps_gen_bizmodify0](
@cmpid int,
@bizid int
)
as
begin
set nocount on
declare @s1 nvarchar(100) 
declare @tbname varchar(50)
declare @dbname varchar(50)
declare @fkey   varchar(50) 
exec sys_sql_getTableNamePk @cmpid,'biz',@bizid,0,@tbname output,@fkey output ,@dbname output 

declare @sql nvarchar(MAX) 
set @sql = N'
-- 生成时间:'+convert(varchar(20),getdate(),120)+N' by ebs-core  
'
if (dbo.checkprocedure(@tbname+'_modify_0')=0) set @sql=@sql+'alter ' else set @sql=@sql+'create '
set @sql = @sql+' procedure '+@tbname+N'_modify_0(
     @ordid bigint, 
     @idname varchar(50), 
     @text text ) 
as  
begin  
declare @id3 bigint 
select top 1 @id3 = ord3_id from '+@dbname+@tbname+N'_0 where ord3_ordid = @ordid  and ord3_idname=@idname 
set @id3 = isnull(@id3, 0) 
if (@id3 = 0) 
begin 
insert into '+@dbname+@tbname+N'_0(ord3_ordid, ord3_idname, ord3_text) values(@ordid, @idname, @text) 
end else 
begin 
update '+@dbname+@tbname+'_0 set ord3_text = @text where ord3_id = @id3 
end 
end 
 '
exec myprint @sql 
execute(@sql)
-- 生成mps_sql 
set @sql = ' exec mps_sys_gen_mpssql '+CONVERT(varchar(10),@cmpid)+','''+@tbname+N'_modify_0'',
''@ordid bigint,@idname varchar(50),@text text''' 
execute(@sql)
set nocount off 
end