Link to home
Start Free TrialLog in
Avatar of CISS
CISSFlag for United States of America

asked on

T-SQL handling BETWEEN with two parameters

I'm trying to use between to identify when a value falls between 2 numbers. For example
select rec from xxx where 100 between 50 and 200 This returns the rows however if I flip the numbers
select rec from xxx where 100 between 200 and 50 it fails

End User will be entering beginning and ending sequence numbers its possible that the entries will be reversed where the larger number is actually the beginning sequence number So I cant just flip the numbers to satisfy the rule.
ASKER CERTIFIED SOLUTION
Avatar of Scott Pletcher
Scott Pletcher
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial