Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
jassie
Constraint Violating Yak Guru
332 Posts |
Posted - 2014-02-10 : 15:30:01
|
In an existing SSRS 2008 report, I need to add a parameter called State. The value for the field called state is definedas a bit. State = 0 is for NE, State = 1 is for MN. I also need to add a selection for both where the user can select either MN or NE states. Thus my questions are the following:1. The value for both can be a bit value of either 0 or 1. Thus when assigning parameter values, how can I assign a value for 'BOTH' that means 1 or 0? I can assign NE to mean 0 and I can set 1 to mean MN. However I do not know how toassign the value for 'both'? Should I use a dataset to define the value? If so, can you how me the sql I can use to populate the values in a dropdown list box?2. For the main query to get the values I want, how would I setup the sql? Would I use =@state or would I use in (@state)? |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2014-02-11 : 00:56:28
|
1. Set Allow Null value property for parameter. then in query behind use logic like below...((@State = 1 AND StateColumn = 'MN')OR (@State = 0 AND StateColumn = 'NE')OR @STate IS NULL).. this would make sure it ignores @State parameter when NULL is passed and you will get all state information for that2. just like what i showed before you can write two conditions------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
jassie
Constraint Violating Yak Guru
332 Posts |
Posted - 2014-02-11 : 10:45:54
|
Thanks! |
|
|
|
|
|