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

Pulling out the first occurence of a four-digit number from a field

Status
Not open for further replies.

Rydel

Programmer
Feb 5, 2001
376
CZ
Sorry if this is a very basic simple question for SQL gurus. So here's the problem:

I have a large text field in a table "people" (field named "CV") and I want to pull out the first four digit number I find in this field and store it in another field called "year_born". The problem is that "CV" field has differen format for different people:

"some text (1970-xxxx)..."
"other text... born 1951"
"(1920-2004)..."

But in 99% of the cases the first four-digit number <i>is</i> the year of birth. Is there a quick way of pulling it out from the "CV" field using SQL?

Big thanks in advance!



regards,
rydel n23
 
Sorry, but actually the table is currently in MS Access, so if possible could you please give Jet SQL syntax, not Transact-SQL (in case there would be differences).



regards,
rydel n23
 
Post in the Access forum.
-Karl

[red] Cursors, triggers, user-defined functions and dynamic SQL are an axis of evil![/red]
[green]Life's uncertain...eat dessert first...www.deerfieldbakery.com[/green]
 
Alright. Sorry. Should I delete it?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top