Solved

Execute store procedure with Openquery

Posted on 2009-06-29
3
2,127 Views
Last Modified: 2012-05-07
Hello,

I have created a linked server between an sql server 2000 and sql server 2005 express, named svr02\svr02

In the linked server svr02 i have create a simple Stored Procedure 'sp_CreateOrder' with no parameters which inserts a row into a test table 'Orders'. This stored procedure works from the second server svr02.

I'm trying to use this from the first server using openquery
SELECT * FROM OPENQUERY([svr02\svr02], 'Order.dbo.sp_CreateOrder');

this gives the following error
OLE DB error trace [Non-interface error:  OLE DB provider unable to process object, since the object has no columnsProviderName='SQLOLEDB', Query=Order.dbo.sp_CreateOrder'].
Msg 7357, Level 16, State 2, Line 1
Could not process object 'Order.dbo.sp_CreateOrder'. The OLE DB provider 'SQLOLEDB' indicates that the object has no columns.

Openquery works fine when i do select statements.

Thank you
Teo
0
Comment
Question by:temmelv
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 31

Expert Comment

by:RiteshShah
ID: 24743038
what is your database name? Is it "Order"?
0
 
LVL 31

Accepted Solution

by:
RiteshShah earned 500 total points
ID: 24743071
if you have add linked server and wants to call it's stored procedure than you have to use following syntax

exec [svr02\svr02].[databaseName].dbo.sp_CreateOrder

use four part while calling SP. first is server name, second is database name which has your SP, third is owner name, and finally stored procedure name.
0
 

Author Comment

by:temmelv
ID: 24744153
This worked
exec [svr02\svr02].[databaseName].dbo.sp_CreateOrder

but is also needed

exec sp_serveroption @server='myserver', @optname='rpc', @optvalue='true'
exec sp_serveroption @server='myserver', @optname='rpc out', @optvalue='true'

Thank you.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question