For details about the configuration of the COM + environment, see the excerptArticleDistributed transactions (1) --- MTS settings
Http://blog.csdn.net/honkerhero/archive/2007/03/28/1544072.aspx
For troubleshooting of running problems, see file SQL Distributed Transaction error solution.
Http://blog.csdn.net/honkerhero/archive/2007/04/06/1553748.aspx
1. Create a remote connection server ------------------------------------- sp_add1_server
Sp_addmediaserver [@ Server =] 'server' [, [@ srvproduct =] 'product _ name']
[, [@ Provider =] 'provider _ name']
[, [@ Datasrc =] 'data _ source']
[, [@ Location =] 'location']
[, [@ Provstr =] 'provider _ string']
[, [@ Catalog =] 'catalog'
For example, exec sp_addmediaserver @ Server = '000000', @ srvproduct = '', @ provider = 'sqloledb', @ datasrc = '192. 168.20.15'
2. Create remote logon ---------------------- sp_add1_srvlogin
Sp_add1_srvlogin [@ rmtsrvname =] 'rmtsrvname'
[, [@ Useself =] 'useself ']
[, [@ Locallogin =] 'locallogin']
[, [@ Rmtuser =] 'rmtuser']
[, [@ Rmtpassword =] 'mtpassword']
Example: exec sp_add1_srvlogin @ rmtsrvname = '000000', @ useself = 'false', @ rmtuser = 'sa ', @ rmtpassword = 'sa'
3. Set Remote Server (this step is optional) -------------------------- sp_serveroption
For more information, see online help!
For example, exec sp_serveroption '123', 'Lazy schema valider', 'true'
4. Execute distributed transactions
Set xact_abort on
Set ansi_null_dflt_on
Set ansi_warnings on
Begin distributed tran
Insert into [2015] .pubs.dbo.jobs (job_desc, min_lvl, max_lvl) values ('cc)
Select * from [2015] .pubs.dbo.jobs
Insert into pubs.dbo.jobs values ('cc', 100,100)
Select * From pubs.dbo.jobs
-- Commit tran
Rollback tran