I know it's an old post but the following should help a lot.http://www.mcpressonline.com/index2.php?option=com_content&do_pdf=1&id=1541
The keys to the magic appear in the following...
-- Create Linked Server using ODBC DSN "AS400"
@srvproduct=N'DB2 UDB for iSeries',
-- Define the credentials that will be used to
-- access objects hosted by the Linked Server
-- RPC option is required for doing EXEC AT
EXEC sp_serveroption 'DB2400', 'rpc out', true
The biggest key here is that you must use the MSDASQL driver and you must enable "rpc out".
The article at the link also gives an example call to return a result set as follows... Obviously, the temp table must already exist but that's also covered in the article.
--To be clear, I've not tried any of this, yet. Our infrastructure team is in the process of installing the correct MSDASQL driver.
-- A DB2 stored procedure can be executed
Set @OrderID = 10249
Insert Into #tmpOrderHdr
Exec ('Call DATALIB.GetOrders (?)', @OrderID) AT DB2400
is pronounced ree-bar and is a Modenism for R
First step towards the paradigm shift of writing Set Based code: Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
Although they tell us that they want it real bad, our primary goal is to ensure that we dont actually give it to them that way.
Although change is inevitable, change for the better is not.
Just because you can do something in PowerShell, doesnt mean you should. Helpful Links:
How to post code problemsHow to post performance problemsForum FAQs