2

I have a varchar(11) table and all its entries will look something like this.

Table
123456-7890
101112-1314

I need to find everything that has

??12??-????

(? Being any character) How would I do this?

Edit: Thanks bill!!

SELECT * FROM myTable WHERE myfield LIKE '__12%'

Is what i was looking for :)

0

2 Answers 2

4
WHERE YourColumn LIKE '__12__-____'

The _ means "match any single character"

Sign up to request clarification or add additional context in comments.

Comments

1

Assuming you're using ANSI SQL, what you're looking for is '_':

SELECT * FROM myTable WHERE myField LIKE '__12__-____'

For most Microsoft products, the question mark, as you used it is, is correct.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.