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

Replacement for IN 1

Status
Not open for further replies.

Mike555

Technical User
Feb 21, 2003
1,200
US
I'm using a WHERE clause in a stored procedure like the one illustrated below. In this example the effected records are the records where the OrderID = 1,2,3,4,5.
Code:
WHERE (ID = @ID) AND (OrderID IN (1,2,3,4,5))
I'm trying to figure out how I can specify a range of numbers instead of identifying each one individually. I'd like to do something like...
Code:
WHERE (ID = @ID) AND (OrderID IN (1-5))

Obviously I know I can't use the IN statement to accomplish this. But could someone give me an idea of how I could specify a range? Thanks.


--
Mike
 
Thank you both for your help. Vongrunt got the star since I had it implemented and tested seconds before mdp's post.

Thanks again!

--
Mike
 
Just note that on some versions of SQL (not MS SQL Server), the between operator is not inclusive for both operands.

-------------------------------------
It is better to have honor than a good reputation.
(Reputation is what other people think about you. Honor is what you know about yourself.)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top