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 2005 Forums
 Transact-SQL (2005)
 Mult Parameter Help

Author  Topic 

werhardt
Constraint Violating Yak Guru

270 Posts

Posted - 2008-03-27 : 14:08:11
I am working on a report for a client and in the parameter field they would like to be able to use different date ranges if needed. The fields they would like to have parameters for would be Effective Date, Tracking Date, ReCred Letter Sent Date, ReCred Complete Date. Instead of making 4 different reports, I was looking for something I can put in my statement so she can pull either fields.

This is what I thought would work. I am using Microsoft Visual studio. If you think it is better for me to put it in my actual SQL I can do that too.

Here is what I was doing below. The when I try and run the report, it tells me that I need to have a value in each one of my parameters. Can this type of formula work or do I need to have 4 separate reports.

([Tracking Thru Date] >= @trackfrom) AND ([Tracking Thru Date] <= @trackthru) or
([Effective Date] >= @efffrom) AND ([Effective Date] <= @effthru)or
([ReCred Letter Sent Date] >= @sentfrom) AND ([ReCred Letter Sent Date] <= @sentthru) or
([ReCred Complete Date] >= @compfrom) AND ([ReCred Complete Date] <= @thru)

Thanks!

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-03-27 : 14:46:53
Not fully clear froim your explanation, are you using a single parameter for all date values or are you using seperate parameters? Also, if you are using seperate parameters have you set 'a''ow null value' propertuy to be true for all of them?
Go to Top of Page
   

- Advertisement -