KR
Feb 6, 1:48 pm show options
Newsgroups: microsoft.public.access.forms
From: "KR" <kra...@bastyr.edu> - Find messages by this author
Date: 6 Feb 2006 13:48:00 -0800
Subject: Extract Number from Fields - SQL
Reply | Reply to Author | Forward | Print | Individual Message | Show
original | Remove | Report Abuse
I am new to the SQL world, and I am trying to come up with a script
that will extract only the numerical data from a column of varchar
data type . There is not a pattern to the data entered, except that
the data that
I am looking to extract is a three digit number. If someone could
point me in the right direction that would be great.
Thanks in advance
KR 5 1434
KR (kr****@bastyr.edu) writes: I am new to the SQL world, and I am trying to come up with a script that will extract only the numerical data from a column of varchar data type . There is not a pattern to the data entered, except that the data that I am looking to extract is a three digit number. If someone could point me in the right direction that would be great.
SELECT cast(col as int) FROM tbl WHERE col LIKE '[0-9][0-9][0-9}'
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se
Books Online for SQL Server 2005 at http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at http://www.microsoft.com/sql/prodinf...ons/books.mspx
On 6 Feb 2006 13:53:35 -0800, KR wrote: KR Feb 6, 1:48 pm show options
Newsgroups: microsoft.public.access.forms From: "KR" <kra...@bastyr.edu> - Find messages by this author Date: 6 Feb 2006 13:48:00 -0800 Subject: Extract Number from Fields - SQL Reply | Reply to Author | Forward | Print | Individual Message | Show original | Remove | Report Abuse
I am new to the SQL world, and I am trying to come up with a script that will extract only the numerical data from a column of varchar data type . There is not a pattern to the data entered, except that the data that I am looking to extract is a three digit number. If someone could point me in the right direction that would be great.
Hi KR,
The function you would use to find where a three digit sequence in
varchar data is located is
POSINDEX ('%[0-9][0-9][0-9]%', CharData)
--
Hugo Kornelis, SQL Server MVP
On Mon, 6 Feb 2006 23:19:18 +0000 (UTC), Erland Sommarskog wrote: Hugo Kornelis (hu**@perFact.REMOVETHIS.info.INVALID) writes: The function you would use to find where a three digit sequence in varchar data is located is
POSINDEX ('%[0-9][0-9][0-9]%', CharData)
patindex, you mean, n'est-ce pas?
Ah, oui, c'est vrai!!
Thanks for the catch, Erland!
--
Hugo Kornelis, SQL Server MVP This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: 2mc |
last post by:
Generally speaking, if one had a list (from regular Python) and an
array (from Numerical Python) that contained the same number of
elements, would a While loop or a For loop process them at the...
|
by: Carl |
last post by:
I have been using Python for quite some time now and I love it. I use it
mainly for explorative computing and numerical prototyping, ie testing and
trying out different kinds of algorithms and...
|
by: Clint Norton |
last post by:
Hi all,
I'm a student currently in the beginning of my master's degree and
I'm searching for an interesting open source project written in Python
to contribute to.
I have worked as a programmer...
|
by: Lampa Dario |
last post by:
Hi,
I need to estract single characters in a string, that may be '0' or '1',
and evaluate them.
I defined these variables
char *binary;
char cypher;
int value;
|
by: Pol Bawin |
last post by:
Hi All,
Did somebody already define attributes for numerical properties to define
value : minima, maxima, a number of decimal, ...? This information would be
useful to unify syntax
Polo
|
by: kux |
last post by:
Hello everyone,
I hope someone is out here who can help me with a simple calculation...
I have a sales data base in access with monthly sales history by
product. to make future predictions I...
|
by: arnaudk |
last post by:
Hello,
I am relatively new to C++ and have been milling over a container related problem for a while now. I have a ~2Gb ASCII file of time-ordered data with 4 comma-separated columns. The first...
|
by: RN1 |
last post by:
Consider the following code snippet:
<%
Dim intA, strA, strB
intA=5
strA="Hello World"
strB=strA+intA
Response.Write(strB)
%>
|
by: Maria DiGiano |
last post by:
I am using Access to organize data from a survey which uses a Likert
scale to measure response- the scale is 3 points- "I agree", "I don't
know" and "I disagree". The numerical value of each...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |