Tuesday, March 27, 2012

dynamic query

hi,

i'm using dynamic query in the dataset because i wanted the result to group by the particular parameter selected.

however, another parameter requires the data to be taken from another table.

is the following syntax acceptable?

=if (Parameters!rev_data = 'A')

begin

"select a,b,c.... from tableA"

end

else

begin

"select d,e,f.... from tableB"

end

i encounter this error : 'Expression expected'...

is the syntax wrong or this way is not possible?

thanks!

I use Stored Procedures to generate dynamic SQL used for reports. The conditional logic is handled in T-SQL to generate and execute the appropriate SQL based on the input parameters. For example, when users want to select the sort fields and sort order for the data in a report.|||Can you give us an example of how you made this work in the stored procedure?

No comments:

Post a Comment