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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using ALL in SQL parameters

Status
Not open for further replies.

MRWARNER

Technical User
Nov 6, 2003
20
0
0
US
Using SQL 2000 Stored Procedures I needed to pass an ALL parameter back to CR9. I couldnt find any information on this for SQL. I borrowed and altered an idea from a friend and it seems to work just great.

Can anyone think of any reason why this might not work?

I created a temp table and put this code between the Where Statement and Select from temp table statement. I am doing this on two parameters so the user can choose a specific item or have them all appear.
Code:
WHERE   PROV_CRED_PEND.Date_pend IS NOT NULL  
	AND PROV_CRED_PEND.Date_unpend IS NULL  
	AND GETDATE() between Vendor.EFF_DATE and Vendor.EXP_DATE 


IF @STAT NOT LIKE 'ALL' DELETE FROM #CS WHERE CREDSTAT NOT LIKE @STAT
IF @PROD NOT LIKE 'ALL' DELETE FROM #CS WHERE PRODUCT NOT LIKE @PROD


SELECT * FROM #CS
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top