views:

9

answers:

2

Hi I'm sure this is possible but am not sure how to go about it. In this case I want to find records that have text similar to this pattern '123-1234'

SELECT FROM TABLE WHERE COLUMN = 'HAS pattern 3 numbers+ - + 4numbers'

I think the numbers are post codes perhaps. Still bit of an sql noob. Any helpers appreciated.

+1  A: 

A hunch: http://msdn.microsoft.com/en-us/library/ms179859.aspx

Jeroen
Thanks, didn't think the LIKE keyword would do this. Was thinking they'd be some kind of regex for sql.
Chin
+1  A: 

Assuming the phone number is anywhere in the column:

SELECT FROM TABLE WHERE COLUMN LIKE '%[0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]%'
LittleBobbyTables