?
Solved

Checking part of a Column for numeric in SYBASE SQL

Posted on 2009-07-09
5
Medium Priority
?
615 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 1100 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 900 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

Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

Question has a verified solution.

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

This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
The Summer 2017 Scholarship Winners have been announced!
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 …
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

752 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