Solved

Checking part of a Column for numeric in SYBASE SQL

Posted on 2009-07-09
5
614 Views
Last Modified: 2012-05-07
iF A COLUMN IS CHAR (8) NAMED ANYFIELD1.  AND THE TABLE NAME IS "ANYTABLE1'
How can I select all rows from table ANYTABLE1where ANYFIELD1  HAS THE LAST 4 CHARACTERS NUMERIC.

   
0
Comment
Question by:garyinmiami2003
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 8

Expert Comment

by:koppcha
ID: 24817040
IN 15.0 I think you can use

isnumeric(substring(anyfield1,5,4))=1
0
 
LVL 8

Accepted Solution

by:
koppcha earned 275 total points
ID: 24817351

check if this works

SELECT *
FROM    ANYTABLE1
WHERE  SUBSTRING(ANYFIELD1,5,4) NOT LIKE '%[^0-9]%'
0
 
LVL 6

Assisted Solution

by:IncisiveOne
IncisiveOne earned 225 total points
ID: 24817525
If you want characters 5 to 8 that ARE numeric, that should be

SELECT *
FROM    ANYTABLE1
WHERE  SUBSTRING(ANYFIELD1,5,4)  LIKE '[0-9][0-9][0-9][0-9]'

Cheers
0
 
LVL 8

Expert Comment

by:koppcha
ID: 24817763
I think they both are same
one is saying not to select if it has atleast one non interger data and other one i saying to select data if all 4 charaters are digits.
0
 

Author Closing Comment

by:garyinmiami2003
ID: 31601716
I awarded the most points for the one I used.  I decided that the positive logic as opposed to negative was better for what I am doing but either would be acceptable.  Thank you very much for the assistance  
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The conference as a whole was very interesting, although if one has to make a choice between this one and some others, you may want to check out the others.  This conference is aimed mainly at government agencies.  So it addresses the various compli…
Make the most of your online learning experience.
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question