Avatar of mte01
mte01
Flag for Lebanon asked on

Executing SP from SQL Server Linked server

Hey experts,

  I have a sql server 2005 from which I've created a linked server on an sql server 2008 DB using the following connection string:

'Data Source=192.168.168.14,1433;Network Library=DBMSSOCN;Initial Catalog=EmeraldCalls;Enlist=false'

Note that I'm doing it this way in order to be able to add the Enlist=false flag to be able to execute a stored procedure without being enlisted in a txn (if I create a regular linked server, it won't allow me to execute a SP without setting the 'remote proc transaction promotion' option to false, and since my primary server is 2005, I can't set this option).

The connection is working successfully, and I'm using a user login that has all privileges (similar to sa), but I'm not able to execute any stored procedure (it errors out with "could not find stored procedure..etc")

Any idea on how to fix this?
Microsoft SQL ServerMicrosoft SQL Server 2005Microsoft SQL Server 2008

Avatar of undefined
Last Comment
mte01

8/22/2022 - Mon
Nakul Vachhrajani

Because it's a linked server, have you tried using the EXECUTE...AT option? http://beyondrelational.com/modules/2/blogs/77/posts/11274/executing-queries-against-linked-servers.aspx
Vitor Montalvão

Can you post how are you trying to execute the SP?
mte01

ASKER
This is how I'm trying to execute it:

EXEC [192.168.168.14].EmeraldCalls.dbo.IIIGUsersConsumptionByMonth @yearn, @monthn
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
Vitor Montalvão

If you have a linked server you should use the linked server name. Why are you using an IP address?
mte01

ASKER
This is the linked server name (we name them by IP to be able to recognize them).
Everything else is working (selecting from tables, views..etc)
Vitor Montalvão

I see.
Then check if the remote access is enabled on both instances:
EXECUTE sp_configure 'remote access'

Open in new window

If returns 1 then it is. If not you need to reconfigure it to allow remote access.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
mte01

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
mte01

ASKER
And apparently Enlist=false comes by default, so that's how it worked.
mte01

ASKER
I was able to fix the issue in the connection string myself