SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Show Different COLUMNS in Dataset output each time in SSRS


Show Different COLUMNS in Dataset output each time in SSRS

Author
Message
ms-techie
ms-techie
SSC Journeyman
SSC Journeyman (85 reputation)SSC Journeyman (85 reputation)SSC Journeyman (85 reputation)SSC Journeyman (85 reputation)SSC Journeyman (85 reputation)SSC Journeyman (85 reputation)SSC Journeyman (85 reputation)SSC Journeyman (85 reputation)

Group: General Forum Members
Points: 85 Visits: 56
Currently I have a Report , which gets populated from a dataset.

Now this dataset has a CTE in it. Now the output of the dataset contains SELECT Values from CTE . I want to change the logic in such a way , that when the @@rowcount of the first SELECT CTE is 0 , then it should show me another SELECT QUery . Is that possible.

Because when I write 2 SELECT queries , then the dataset picks up the last query columns .It should instead pickup the columns of that SELECT Query dynamically where the number of rows returned is not ZERO.

How can I acheive this ?
SQLRNNR
SQLRNNR
SSC Guru
SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)

Group: General Forum Members
Points: 66219 Visits: 18570
Combine the queries into a single query (if possible).


You could also create parameters in your report that pass different values to a stored procedure. Based on those parameters, a different set of columns could be returned.



Jason AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server, MVP


SQL RNNR

Posting Performance Based Questions - Gail Shaw

Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search