Advice needed on creating a dynamic report in SQL Server Reporting Service 2008

  • My current assignment is putting me at some problems.

    I need to create a report, where the user has to give in Database name, select a table and then select the fields to display.

    Getting a list of tables I probably can get from the metadata after the user given in a database name.

    Getting a selection of fields is harder, the example I've found on

    works with a stored procedure.

    Off course this beats the entire purpose of the exercise, so can I effectively get the same result but without a stored procedure.

    I encountered 2 problems so far:

    SELECT name

    FROM xxx.dbo.sysobjects

    WHERE xtype = 'U'

    xxx should be replaced with the database name given, but how do I translate this into a dataset

    The following query is not the problem but part of it

    SELECT column_name

    FROM xxx.information_schema.columns

    WHERE table_name = @Tables

    I assign this to a parameter @Fields multiple values allowed now I need a way to show these in the report.

    Any advice would be appreciated

    PS

    When I was typing this post it was intended as a help needed but as I was writing I realised how I could do it.

    However then it came to a point where I no longer needed the explicit help but rather advice on how to best do it.

  • OK the first problem has been result

    It gives off an error since refresh of an input box by parameters gets refreshed when hitting enter.

    So maybe I should replace the input with another list of available databases

    SELECT name

    FROM sys.databases

    This will give me that list

    SELECT name

    FROM sys.sysdatabases

    This will also give me that list but which of these 2 is more recent in SQL Server

    Remains now is to get a record set for all the selected fields and putting this into a table or matrix.

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

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