SQLTeam.com | Weblogs | Forums

Columns not loading in ssrs for if else logic sp


#1

Dear Team,

I have IF ELSE logic in my sp, where in IF returns different columns and ELSE returns different set of columns.

but when i integrate it with SSRS report, i am getting always ELSE clause columns.

How to call this kind of sp in Report.

Thank you in advance!


#2

You need to ensure that the columns (number, name and type) are the same on both branches of the IF statement. Otherwise SSRS can't figure out which result set to use. For that matter, how can you write a report when you don't know if you're getting columns A,B,C or D,E,F?