Note that there are some explanatory texts on larger screens.

plurals
  1. POExecute DB2 iSeries Stored Procedure from a SQL 2005 Linked Server
    primarykey
    data
    text
    <p>I am trying to execute a stored procedured from a linked database in MS SQL 2005. The linked database is a db2 database on a iseries server. I am using the iSeries IBMDASQL service provider. I am able to query the stored procedure without problems using a simple vbscript and ado. When I try to execute the same stored procedure in query analyzer on the SQL Server, I never see any results. Query analyzer always show 'command executed' and when I execute the select * on the temp table, no values appear. What am I doing wrong????? Thanks!</p> <p>--code from query analyzer below--</p> <pre><code>DECLARE @emailToAddress char(50) DECLARE @emailFromAddress char(50) set @emailToAddress = 'customer.service@company.com' set @emailFromAddress = 'customer@gmail.com' If Object_ID('tempdb..#tmpResultTbl') Is Not Null Drop Table #tmpResultTbl Create Table #tmpResultTbl ( OUTPGMID Char(150)) --SET FMTONLY Off Set NoCount On Insert Into #tmpResultTbl EXEC ('CALL abicqual.VP_GETCCEPGMID(?, ?) ', @emailToAddress, @emailFromAddress) AT MAM400 Select * From #tmpResultTbl </code></pre> <p>UPDATED: Here is the updated code to use openquery... still no luck :(</p> <p>DECLARE @TSQL varchar(8000) DECLARE @emailToAddress varchar(50) DECLARE @emailFromAddress varchar(50) SET @emailToAddress = 'customer.service@company.com' SET @emailFromAddress = 'customer@gmail.com' SET @TSQL = 'SELECT * FROM OPENQUERY(MAM400,''CALL abicqual.VP_GETCCEPGMID(''''' + @emailToAddress + ''''', ''''' + @emailFromAddress + '''''' + ')''' + ')' Print @TSQL EXEC (@TSQL)</p> <p>--output below-- SELECT * FROM OPENQUERY(MAM400,'CALL abicqual.VP_GETCCEPGMID(''customer.service@company.com'', ''customer@gmail.com'')') Msg 7357, Level 16, State 2, Line 1 Cannot process the object "CALL abicqual.VP_GETCCEPGMID('customer.service@company.com', 'customer@gmail.com')". The OLE DB provider "IBMDASQL" for linked server "MAM400" indicates that either the object has no columns or the current user does not have permissions on that object.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload