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!

Determining Data Types

Status
Not open for further replies.

NWChowd

Programmer
May 26, 2002
84
0
0
US
Hi there,

I have a situation in which I need to do one thing if the values of a field ("ServiceCode") fall within the range of 100-299, and do something else if the value is outside this range. The problem is that ServiceCode field has a datatype of char(6), and there are some non-numeric values in that field.

So the logic needs to be:

If ServiceCode is a number datatype (int or decimal) AND ServiceCode is between 100 and 299, then <Do Something>
Else NULL


Additionally, this statement needs to be within a larger Select statement.

I.E.

SELECT
FIELD1,
FIELD2,
<LOGIC FROM ABOVE>,
FIELD4
FROM TABLE_X
WHERE <BLAH>


Any suggestions?



Thanks,
NWChowd

======================================
"I wish that I may never think the smiles of the great and powerful a sufficient inducement to turn aside from the straight path of honesty and the convictions of my own mind."
-David Ricardo, classical economist
======================================
 
How the records that have non digits lookes like? Is they all chars w/o and digit in it or thay are mixed digits and chars?

Borislav Borissov
 
There are some alpha-numeric values, strictly numeric values, and strictly alpha values.

======================================
"I wish that I may never think the smiles of the great and powerful a sufficient inducement to turn aside from the straight path of honesty and the convictions of my own mind."
-David Ricardo, classical economist
======================================
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top