BETWEEN in WHERE Clause

Please support our MS SQL advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Jun 2007
Posts: 44
Reputation: kshrini is an unknown quantity at this point 
Solved Threads: 3
kshrini kshrini is offline Offline
Light Poster

BETWEEN in WHERE Clause

 
0
  #1
May 20th, 2008
Hi All,

SELECT * FROM Results WHERE ActualValue NOT BETWEEN Lowerimit AND UpperLimit

In my query ActualValue is VARCHAR field. How can I get Results that are out of limit?

Shrinivas
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 6
Reputation: gvalip is an unknown quantity at this point 
Solved Threads: 1
gvalip gvalip is offline Offline
Newbie Poster

Re: BETWEEN in WHERE Clause

 
0
  #2
May 21st, 2008
It looks you have some alpha numeric upper and lower limits. You can look for the pattern of data to create a string and pass it to the query. Another way is to re-phrase the query but I am not too sure of the data and table size. If you can provide some more details I can try and look at it.
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 44
Reputation: kshrini is an unknown quantity at this point 
Solved Threads: 3
kshrini kshrini is offline Offline
Light Poster

Re: BETWEEN in WHERE Clause

 
0
  #3
May 21st, 2008
Originally Posted by gvalip View Post
It looks you have some alpha numeric upper and lower limits. You can look for the pattern of data to create a string and pass it to the query. Another way is to re-phrase the query but I am not too sure of the data and table size. If you can provide some more details I can try and look at it.

Thanks for reply.
I did it this way:
  1. SELECT * FROM Results
  2. WHERE STID=111 AND (CASE WHEN (ISNUMERIC(ActualValue)=1) THEN CAST(ActualValue AS FLOAT) ELSE 0 END) NOT BETWEEN LowerLimit AND HigherLimit
Last edited by peter_budo; May 23rd, 2008 at 12:06 pm. Reason: Keep It Organized - please use [code] tags
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 6
Reputation: gvalip is an unknown quantity at this point 
Solved Threads: 1
gvalip gvalip is offline Offline
Newbie Poster

Re: BETWEEN in WHERE Clause

 
0
  #4
May 21st, 2008
Just curious, how many records are selected out of this query from the total.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC