The Straight Dope

Go Back   Straight Dope Message Board > Main > General Questions

Reply
 
Thread Tools Display Modes
  #1  
Old 04-11-2006, 12:34 PM
zev_steinhardt zev_steinhardt is offline
Charter Member
 
Join Date: Jan 2000
Location: Brooklyn, NY
Posts: 6,768
SQL Server DBAs! Please help!

I know that this isn't a database board, but I'm posting on the off-chance that someone can help me out here.

I'm having a problem passing a parameter value into a stored procedure
that I am running on a remote (linked) server, and am receiving a DTC
error because of it.

I have a stored procedure that brings in a variable (@CustID int). I
later pass that parameter to another stored procedure. The code looks
like this...


EXEC LinkedServer.dbname.dbo.spname @CustID


When I run that, I get this error...


Server: Msg 7391, Level 16, State 1, Procedure spname, Line 394
The operation could not be performed because the OLE DB provider
'SQLOLEDB' was unable to begin a distributed transaction.
OLE DB error trace [OLE/DB Provider 'SQLOLEDB'
ITransactionJoin::JoinTransaction returned 0x8004d00a].
[OLE/DB provider returned message: New transaction cannot enlist in the
specified transaction coordinator. ]


However, if I hard-code the parameter, it works:


EXEC LinkedServer.dbname.dbo.spname 1234 -- this works.


I can even do this:


DECLARE @var int
SET @var = 1234
EXEC LinkedServer.dbname.dbo.spname @var -- this works too.


But if I accept the variable as an input parameter to my stored
procedure, I get the error listed above.


Any help you can provide would be greatly appreciated.

Zev Steinhardt
Reply With Quote
Advertisements  
  #2  
Old 04-11-2006, 01:47 PM
Athena Athena is online now
Charter Member
 
Join Date: May 1999
Location: da UP, eh
Posts: 11,736
My first thought is that @CustID has some sort of bad value (a null maybe?) that is causing the error you see. Try dumping @custid and seeing what it looks like.

My second thought is that maybe it's something caused by the remote connection. Is there any way you can test it locally?

I also see this from MS about the error. Anything ring a bell there?
Reply With Quote
  #3  
Old 04-11-2006, 03:45 PM
Armilla Armilla is offline
Guest
 
Join Date: Mar 2001
Sounds like a permissioning problem with the DTC. Have a look at the MS KB article below and see if that helps:

http://support.microsoft.com/default...32&Product=sql
Reply With Quote
  #4  
Old 04-11-2006, 09:40 PM
cwthree cwthree is online now
Guest
 
Join Date: Feb 2004
I'm with Armilla.

What version of SQL Server, including any service packs, are you using on each server? I ran into a similar problem with distributed transactions in SQL Server 2000. As I recall, one server had SQL Server service pack 3a and the other didn't. Installing SP3a on the lower version server corrected the problem.
Reply With Quote
  #5  
Old 04-12-2006, 08:23 AM
crazyjoe crazyjoe is offline
Guest
 
Join Date: Dec 2004
Definitely check the service packs. Distributed transactions and linked servers start to go REALLY wierd sometimes if both servers aren't patched in just the right way. It's one of the more annoying features (heh, features) of SQL Server. All of a sudden out of nowhere you'll get some wierd OLE DB messages between two servers that were happily talking to each other only minutes ago.
Reply With Quote
  #6  
Old 04-12-2006, 12:12 PM
zev_steinhardt zev_steinhardt is offline
Charter Member
 
Join Date: Jan 2000
Location: Brooklyn, NY
Posts: 6,768
Thanks for the help everyone. We eventually decided that transactional processing wasn't all that important and that if only some of the statements go through and not others, it's not all that bad.

We never did figure out what the problem was in the end. The DTC was properly set up on both machines.

Zev Steinhardt
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 03:04 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

Send questions for Cecil Adams to: cecil@chicagoreader.com

Send comments about this website to: webmaster@straightdope.com

Terms of Use / Privacy Policy

Advertise on the Straight Dope!
(Your direct line to thousands of the smartest, hippest people on the planet, plus a few total dipsticks.)

Publishers - interested in subscribing to the Straight Dope?
Write to: sdsubscriptions@chicagoreader.com.

Copyright © 2013 Sun-Times Media, LLC.