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

Parents
  • 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
Reply
  • 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
Children
No Data