Reputation: 249
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 :)
Upvotes: 2
Views: 229
Reputation: 3672
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.
Upvotes: 1
Reputation: 453648
WHERE YourColumn LIKE '__12__-____'
The _
means "match any single character"
Upvotes: 4