Turpan
Turpan

Reputation: 535

SQL querying alpha-numerical values

I have set of data with all kind of values in a column:

XXSE
4032
MX10
3750C
MS073
MSDCC014

How can I specify the query in such way that I will get only those values where first two characters are text and last two characters are numerical, while the value is exactly 4 characters long?

Upvotes: 0

Views: 41

Answers (1)

ughai
ughai

Reputation: 9890

You can use a LIKE '[A-Z][A-Z][0-9][0-9]'

Sample

SELECT 1 WHERE 'MX42' LIKE '[A-Z][A-Z][0-9][0-9]'

Upvotes: 2

Related Questions