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!

Hello If i have a query like thi

Status
Not open for further replies.

goransaler

IS-IT--Management
Mar 6, 2003
56
SE
Hello

If i have a query like this

SELECT * FROM table1 WHERE exid = @exid


if i use this query and like to display all lines from table1
What value should @exid have to show all
or is this not possible

thankfull for answers
 
You can use NULL and the following code

Code:
SELECT * FROM table1 WHERE exid = coalesce(@exid,exid)

which does not search for null though. If you want to handle all cases, you need to have two variables.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top