_ | 覦覈襦 | 豕蠏手 | 殊螳 | 譯殊碁
FrontPage › INSERTEXECUTEStatementsCanExecuteAgainstLinkedServers
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;
蠍 蠍郁鍵..
企: : るジ讓曙 襦螻豺 企Ν 譯殊語. 襦螻豺
EditText : Print : Mobile : FindPage : DeletePage : LikePages : Powered by MoniWiki : Last modified 2018-04-13 23:12:53

螻 蟆 讌 蟆覲企 . (A.)