If Statement to determine WHERE condition in SQL Query
- From: "Rhonda Fischer" <RhondaFischer@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 12 May 2005 07:07:39 -0700
Hello,
The @parameters that I am receiving into my SQL query in SQL Serer 2000
Reporting Services are based on user selection from a drop down combo box.
If the user selects a name it will return an integer. An alternative to
selecting a single name the user can select 'ALL' of which will return a -1
or maybe '*' if allowed. I would like an if stmt to determine if a criteria
be added to the query or not. Can I do this, is there anyway of achieving the
same thing?
SELECT Forename, Username, Description
FROM Audit
WHERE Date >= @Param_StartDate
AND Date < @Param_EndDate
if @Param_UserKey <> -1
AND UserID =@Param_UserKey 'continue to add last line of SQL stmt
There are two more @Parameters to test if the 'ALL' option is selected also
not
sure I can neatly handle this. @Param_RecordType and @Param_ModuleNo.
Thank you kindly for any assistance.
Cheerio
Rhonda
.
- Follow-Ups:
- Re: If Statement to determine WHERE condition in SQL Query
- From: Hugo Kornelis
- Re: If Statement to determine WHERE condition in SQL Query
- From: Anith Sen
- Re: If Statement to determine WHERE condition in SQL Query
- Prev by Date: Re: What does this error mean?
- Next by Date: Re: If Statement to determine WHERE condition in SQL Query
- Previous by thread: Re: What does this error mean?
- Next by thread: Re: If Statement to determine WHERE condition in SQL Query
- Index(es):
Relevant Pages
|
|