Donate SIGN UP

How do you cut/trim a word using SQL and/or Access?

Avatar Image
keys | 11:59 Tue 19th Sep 2006 | Technology
5 Answers
I need to cut a number down that contains letters.
For example
K=GH5678+
K=CV234+

I just need 5678 and 234.

thanks
Gravatar

Answers

1 to 5 of 5rss feed

Best Answer

No best answer has yet been selected by keys. Once a best answer has been selected, it will be shown here.

For more on marking an answer as the "Best Answer", please visit our FAQ.
Can you guaruntee that there will always be 4 characters to be ignored at the start and to always ignore the last character?
select translate ( 'K=GH5678+', translate ( 'K=GH5678+', '1234567890', ' ' ), ' ' ) from
dual;
(Well in sqlplus that is - never used the others.)
Are you reading this database from the web? If so then you can use asp or asp.net.

With that you can loop through the "string" one character at a time and if it passes the "IsNumeric()" test then you keep it. If not, you skip it.
Question Author
thanks

I can guarantee there will be a letter=letterletternumbernumbernumbernumber+

or

letter=letterletternumbernumbernumbernumbernumber+

I have tried Trim, Left and Right. No luck so far.

No Im not using Web just Access and SQL inside that.
SELECT Left(Mid(ColumnName,5),(len(Mid(ColumnName,5))-1)) from tableName


obviously here, ColumnName is the heading of the data such as "CarNumberPlate" and tableName is, well that requires no figuring out.

Does that work? You can also bung in
AS "new table heading name"
just before "from tableName".

1 to 5 of 5rss feed

Do you know the answer?

How do you cut/trim a word using SQL and/or Access?

Answer Question >>

Related Questions

Sorry, we can't find any related questions. Try using the search bar at the top of the page to search for some keywords, or choose a topic and submit your own question.