Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is there a way to have WHERE [column name] = all? 3

Status
Not open for further replies.
Jul 13, 2001
180
US
Is there a way to have WHERE [column name] = all?
If so what is the parameter?
The asterisk does not work there.

By default I wanted to have my query:
SELECT * From GALAXIES Where Category = [parameter], where parameter would be ALL as default.

Is this possible?

Thanks in advance.
 
NOt sure exactly what you mean. BUt I'm presuming you mean you want all possible catergyies to be found.

Do this in a stored procedure with a default value for the parameter of 'all'

Then use and if statement
If @Param1 = 'all'
SElect * from TAble1
Else
Select * from Table1 where Gatefory = @Param1
 
How 'bout
Code:
SELECT * From GALAXIES 
Where Category = [parameter]
      OR [Parameter] = 'ALL'
 
Thank you, I will have to try it on Monday when I get back to work. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top