I am looking for an example of a Query Database Integration Service that shows d

I am looking for an example of a Query Database Integration Service that shows dynamic SQL. Any sugges

OriginalPostID-156490

OriginalPostID-156490

  Discussion posts and replies are publicly visible

  • We have not been able to find a way to include dynamic SQL, although you could get a little fancy by executing code from within a stored procedure. However, your inputs/outputs have to be explicitely defined, so querying a dynamic number of columns will most likely not be possible without somehow combining your data within the procedure and parsing the result within BPM. Something like:

    CREATE PROCEDURE [dbo].[Procedure1]
    @varColumn nvarchar(max),
    @varTable nvarchar(max)
    AS
    BEGIN
    SET NOCOUNT ON;

    DECLARE @SQL nvarchar(max)

    SET @SQL = 'SELECT ' + @varColumn + ' FROM ' + @varTable;

    EXEC (@SQL)
    END
  • ...would you have a code snippet showing how to call a parameterized stored procedure?
  • You can use the Execute Stored Procedure node - Data Source Name is in text format, as ="java:comp/env/jdbc/datasource_name_here", Procedure Name is the plain text name of the procedure, ="ProcedureName". From there, create Inputs for each of your parameters including the output paramater - and map them however you would like. Note, node input names must match the parameter names exactly. Let me know if tha thelps.