2005覯 loopback 襷 覯 伎 INSERT... EXECUTE 讌 讌 . 讌襷 2008覯 讌. 襯 谿瑚.
--sql server 2005
create database work;
go
exec sp_addlinkedserver
@Server='LoopBack'
, @SrvProduct='SQLNCLI'
, @Provider=''
, @DataSrc='localhost'
, @Catalog='work';
exec sp_addlinkedsrvlogin 'LoopBack', 'False', 'Sa', 'userid', 'pw';
go
EXEC sp_serveroption 'LoopBack', 'rpc', 'true'
GO
EXEC sp_serveroption 'LoopBack', 'rpc out', 'true'
GO
use work
go
--drop table test
create table test(id int);
insert test values(1);
insert test(id) exec LoopBack.work.dbo.usp_test;
/*
覃讌3910, 譴16, 2, 譴1
るジ語碁貉ろ碁ゼ譴.
Transaction context in use by another session.
*/
--sql server 2008
create database work;
go
exec sp_addlinkedserver
@Server='LoopBack'
, @SrvProduct=''
, @Provider='SQLNCLI10'
, @DataSrc='localhost\sql2008_ctp6_feb'
, @Catalog='work';
exec sp_addlinkedsrvlogin 'LoopBack', 'False', 'Sa', 'userid', 'pw';
go
EXEC sp_serveroption 'LoopBack', 'rpc', 'true'
GO
EXEC sp_serveroption 'LoopBack', 'rpc out', 'true'
GO
use work
go
--drop table test
create table test(id int);
insert test values(1);
go
create proc usp_test
as
set xact_abort on
select 1
go
insert test(id) exec LoopBack.work.dbo.usp_test;