Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Using linked server to db2 (iSeries)

Author  Topic 

snufse
Constraint Violating Yak Guru

469 Posts

Posted - 2007-10-22 : 16:12:34
I am using linked services on a Sequel Server 2005 and running an exe to a stored procedure on the iSeries (db2):

Exec ('Call QGPL.getallcompanies') AT AS400SRV_IBMDASQL_OLEDB

Result is: Command(s) completed successfully.

No record set is being returned. If I exe the sp from the iSeries navigator it works fine (Call QGPL.getallcompanies ). Any ideas?

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-10-22 : 21:49:00
Tried this?

select * from openquery(AS400SRV_IBMDASQL_OLEDB, 'Exec ('Call QGPL.getallcompanies')')
Go to Top of Page

snufse
Constraint Violating Yak Guru

469 Posts

Posted - 2007-10-23 : 07:41:38
I tried

select * from openquery(AS400SRV_IBMDASQL_OLEDB, 'Exec ('Call QGPL.getallcompanies')')

got error:

Msg 102, Level 15, State 1, Line 1
Incorrect syntax near 'Call'.

Also tried this:

select * from openquery(AS400SRV_IBMDASQL_OLEDB, 'Exec (Call QGPL.getallcompanies)')

got error:

OLE DB provider "IBMDASQL" for linked server "AS400SRV_IBMDASQL_OLEDB" returned message "SQL0104: Token EXEC was not valid. Valid tokens: ( END GET SET CALL DROP FREE HOLD LOCK OPEN WITH ALTER BEGIN.
Cause . . . . . : A syntax error was detected at token EXEC. Token EXEC is not a valid token. A partial list of valid tokens is ( END GET SET CALL DROP FREE HOLD LOCK OPEN WITH ALTER BEGIN. This list assumes that the statement is correct up to the token. The error may be earlier in the statement, but the syntax of the statement appears to be valid up to this point. Recovery . . . : Do one or more of the following and try the request again: -- Verify the SQL statement in the area of the token EXEC. Correct the statement. The error could be a missing comma or quotation mark, it could be a misspelled word, or it could be related to the order of clauses. -- If the error token is <END-OF-STATEMENT>, correct the SQL statement because it does not end with a valid clause.".
Msg 7321, Level 16, State 2, Line 1
An error occurred while preparing the query "Exec (Call QGPL.getallcompanies)" for execution against OLE DB provider "IBMDASQL" for linked server "AS400SRV_IBMDASQL_OLEDB".
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-10-23 : 22:23:41
Which provider do you use? Check 'OLE DB Providers Tested with SQL Server' in books online.
Go to Top of Page
   

- Advertisement -