Table as parameter

  • Hello!

                I’m working with a TableDirect Dataset in my report.

                I would like to configure my table as  parameter, so I can choose which table I would report from.

    Those source tables have the same structure… J

    I’ve already tried “=@table” and “=parameters!table.value”, but it isn’t working… Do you have any idea?

     Thanks,

    ERSONNAME u2:st="on">Richard Chaves

    ERSONNAME>

  • Try to use dynamic sql for this. For example create such a stored procedure

    CREATE PROCEDURE rp_Table

    @TableName nvarchar(100)

    AS

    DECLARE @sql nvarchar(4000)

    SET @sql = 'SELECT * FROM ' + @TableName

    -- print @sql

    EXEC sp_executesql  @sql

    -- print @sql is for debugging purposes. To see that your created string is true.

    a good article you can read is here http://www.algonet.se/~sommar/dynamic_sql.html

    Actually my answer's content is coming almost totally from that article.



    Ready comprehension is often a knee-jerk response and the most dangerous form of understanding. It blinks an opaque screen over your ability to learn. The judgemental precedents of law function that way, littering your path with dead ends. Be warned. Understand nothing. All comprehension is temporary.

    Frank Herbert

  • Thanks Franks!

     

    I've forgot to say that I'm not using SQL as data source ...

    I'm using DataDirect's XML ODBC Driver, so I must use table direct and I can't create procedures to help me on that...

     

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply