Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
| Search | Today's Posts | Mark Forums Read
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old January 11th, 2007, 08:54 AM
Registered User
 
Join Date: Jan 2007
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Trigger nserting in OPENDATASOURCE

hi all,
I have a trigger on a table that inserts data in a external table, referenced through an OPENDATASOURCE call.

The trigger reads :
CREATE TRIGGER whatever On whatevertable
FOR INSERT
AS
insert OPENDATASOURCE('MSDASQL','DSN=Copy;Uid=x;Pwd=y').g db.dbo.Table1
select blabla from inserted

When running this, the INSERT in the original table whatevertable fails giving me a "Distributed Transaction Error"

I can insert the data using OPENDATASOURCE from the Query Analyser.

Any ideas ?

guido

Any ideas

  #2 (permalink)  
Old January 11th, 2007, 09:16 AM
Friend of Wrox
Points: 1,536, Level: 15
Points: 1,536, Level: 15 Points: 1,536, Level: 15 Points: 1,536, Level: 15
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2006
Location: , MI, USA.
Posts: 475
Thanks: 0
Thanked 9 Times in 9 Posts
Default

If the remote table will always be there, it would be best to create a Linked Server for this instead of using OpenDataSource. Has the extra benefit of NOT listing login info in clear code...

--Jeff Moden
  #3 (permalink)  
Old January 11th, 2007, 09:48 AM
Registered User
 
Join Date: Jan 2007
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

So I defined an linked server called "TEST" - it uses the Micorsoft OLE DB for ODBC drivers.

So how do I select the data from this linked table ? Select * from TEST.tablename fails ?

thanks



Similar Threads
Thread Thread Starter Forum Replies Last Post
Trigger sumith ASP.NET 1.0 and 1.1 Professional 0 March 21st, 2007 12:44 AM
Trigger fhillipo SQL Server 2000 1 March 20th, 2007 07:44 AM
Trigger aware SQL Server 2000 1 April 15th, 2005 01:28 PM
Trigger realgone_ SQL Language 4 January 27th, 2005 11:49 AM
Error with OPENDATASOURCE dogcane SQL Server 2000 0 August 5th, 2003 03:25 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.