Image

Imagerydel23 wrote in Imagesqlserver

SQL question - matching four digit

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 see and store it in the 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 is the year of birth. Is there a quick way of pulling it out from the "CV" field using SQL? Big thanks in advance!