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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selct Statement

Status
Not open for further replies.

Brianfree

Programmer
Feb 6, 2008
220
GB
Hi i want to query a table for the following data...

0001106022

However the data in the table is like;

0 001 106 022 or 0-001-106022

Can i strip out any spaces, dashes, full stops etc on query the table?

Many thanks

BF
 
If your db supports regex (regular expressions) in sql, then you can write your sql to use regex to strip out those characters, but there is a performance impact.

The other option is to clean the data to your desired format before insertion into the table.

Bastien

I wish my computer would do what I want it to do,
instead of what I tell it to do...
 
Which RDBMS ?
Which tool for query (DAO, ADODB, ...) ?
What is your actual code ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
you can use replace function:
my_string = replace(my_string, "-", "")
my_string = replace(my_string, " ", "")
my_string = replace(my_string, ".", "")
my_string = replace(my_string, ",", "")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top