--子存储过程
[quote]if object_id('P_CRE_TMP_SUB')<>null
drop proc P_CRE_TMP_SUB
;
create procedure P_CRE_TMP_SUB(@filialeCode char(8), @flag char(8))
as
begin
select Fld_Filiale_Code, Fld_Filiale_Name from FILIALE_TAB where Fld_Flag<>@flag and Fld_Filiale_Code>=@filialeCode
end
;[/quote]
--可能需要如下设置
[quote]exec sp_addserver 'local', null, '192.168.0.10:4100';
exec sp_addexternlogin 'local', 'sa', 'sa', 'sa123';[/quote]
--子存储过程的代理表
[quote]drop table tmp_abc;
create existing table tmp_abc
(Fld_Filiale_Code char(2) null,
Fld_Filiale_Name char(20) null,
_filialeCode char(8) null,
_flag char(1) null /*在现有表中使用“_”的列来定义存储过程的参数,子存储过程将通过名为@+列名的参数将搜索自变量传递到存储过程中*/
)
external procedure
at 'local.DB_CENTER.dbo.P_CRE_TMP_SUB'
;[/quote]
--主存储过程调用代理表
[quote]if object_id('P_CRE_TMP_MAIN')<>null
drop proc P_CRE_TMP_MAIN
;
create procedure P_CRE_TMP_MAIN
as
begin
select * from tmp_abc where _filialeCode='03' AND _flag='9' order by Fld_Filiale_Code
end
;[/quote]
--测试
[quote]exec P_CRE_TMP_MAIN;[/quote]
[quote]if object_id('P_CRE_TMP_SUB')<>null
drop proc P_CRE_TMP_SUB
;
create procedure P_CRE_TMP_SUB(@filialeCode char(8), @flag char(8))
as
begin
select Fld_Filiale_Code, Fld_Filiale_Name from FILIALE_TAB where Fld_Flag<>@flag and Fld_Filiale_Code>=@filialeCode
end
;[/quote]
--可能需要如下设置
[quote]exec sp_addserver 'local', null, '192.168.0.10:4100';
exec sp_addexternlogin 'local', 'sa', 'sa', 'sa123';[/quote]
--子存储过程的代理表
[quote]drop table tmp_abc;
create existing table tmp_abc
(Fld_Filiale_Code char(2) null,
Fld_Filiale_Name char(20) null,
_filialeCode char(8) null,
_flag char(1) null /*在现有表中使用“_”的列来定义存储过程的参数,子存储过程将通过名为@+列名的参数将搜索自变量传递到存储过程中*/
)
external procedure
at 'local.DB_CENTER.dbo.P_CRE_TMP_SUB'
;[/quote]
--主存储过程调用代理表
[quote]if object_id('P_CRE_TMP_MAIN')<>null
drop proc P_CRE_TMP_MAIN
;
create procedure P_CRE_TMP_MAIN
as
begin
select * from tmp_abc where _filialeCode='03' AND _flag='9' order by Fld_Filiale_Code
end
;[/quote]
--测试
[quote]exec P_CRE_TMP_MAIN;[/quote]