Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Executing Sybase Stored procedure from Sql Server 2008 using Linked Server

$
0
0

I have checked previous threads but no use....here is my issue

I am using Linked server created in SQL Server 2008 R2 to connect to Sybase db. The Linked Server works as it gives required results when data is selected from tables. But i am having issues when I execute Stored procedures which accepts like 20-25 parameters it throws error. I have tried different ways of Execution of stored procedure.

Method 1 

exec Linkedserver.Database.group.storedprocedure @Parameter1, @Parameter2, @Parameter3, @Parameter4,.........,@Parameter20,@Parameter21 Out,@Parameter22 Out

It throws below error 

OLE DB provider "ProviderName" for linked server "LinkedServer" returned message "Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.".

Msg 7212, Level 17, State 1, Line 34
Could not execute procedure 'StoredProcedure' on remote server 'LinkedServer'.

Method 2

Exec  ('EXEC Database.group.Storedprocedure @Parameter1,@Parameter2,@Parameter3,@Parameter4,........,@Parameter20',@Parameter21 Out,@Parameter22 Out) AT LinkedServer

It throws below error 

OLE DB provider "ProviderName" for linked server "LinkedServer" returned message "[Sybase][ODBC Driver][Adaptive Server Enterprise]Must declare variable '@Parameter1'.
".
Msg 7215, Level 17, State 1, Line 59
Could not execute statement on remote server 'LinkedServer'.

Method 3

SELECT *
FROM OPENQUERY(LinkedServer, 'SET FMTONLY OFF;  EXEC  Database.group.StoredProcedure @Parameter1,@Parameter2,@Parameter3,@Parameter4,........,@Parameter20 Out,@Parameter21 Out,@Parameter22 Out)

It throws below error 

Msg 7357, Level 16, State 2, Line 50
Cannot process the object "SET FMTONLY OFF; exec Database.group.StoredProcedure  @Parameter1,@Parameter2,@Parameter3,@Parameter4,........,@Parameter20 Out,@Parameter21 Out,@Parameter22 Out". The OLE DB provider "Provider" for linked server "LinkedServer" indicates that either the object has no columns or the current user does not have permissions on that object.


Is it something I am doing wrong, I don't know? Can someone help me I am struggling with this from past 2 days?

Thanks in advance.

Jaya




Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>