Skip to main content

Posts

Showing posts with the label call stored proc from sql to as400

Calling AS400 Stored Proc from MS SQL

Being a newbie to AS400/RPG, it took me a few hours to figure out how to call a stored procedure on AS400 from MS SQL. Here is the straight forward syntax: declare @sql varchar(100) = 'CALL LIBRARY_NAME.STORED_PROC_NAME (''PARAM1'', ''PARAM2'', ''PARAM3'')' exec (@sql) AT NAME_OF_LINKEDSERVER   Make sure that the LIBRARY_NAME is a part of user's library. Make sure to use IBMDASQL OLE DB Provider.