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.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 AND & OR for SSRS

Author  Topic 

aewilson
Starting Member

1 Post

Posted - 2011-07-13 : 14:57:04
Hi All,

I am working on a project where I have TWO veriables but I would like to have one variable or have both variables. right now I have tried the and & or seperate and this does not give me what i want. can some help me?

here is what i am working with. I would like my TP_id to allow blank value when in Reporting Services.

tfdh.tax_prd_end BETWEEN @StartDate AND @EndDate
and tt.tp_id = @tp_id
and dt.line_no <> 'T'

Allan Wilson
Alaskan Analyst Programmer

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2011-07-13 : 17:43:46
Would this work for you?

tfdh.tax_prd_end BETWEEN @StartDate AND @EndDate
and (tt.tp_id = @tp_id or nullif(@tp_id,'') is null)
and dt.line_no <> 'T'
If it performs the correct logic for you, also please take a look at this blog by Erland Sommarskog which addresses some of the performance issues that you may run into with this approach, and discusses alternate ways of doing it.
Go to Top of Page
   

- Advertisement -