I'm trying to filter data from my table using regex pattern in SQL Management Studio 2008 R2.
My table "Asset" contain the column "Asset_n" which contains the asset names. The goal is to be able to filter five types of names only:
- contains only five numerical characters e.g
12345 - contains only six numerical characters e.g
123456 - contains five numerical characters and end with one or two no numerical e.g.
12345aor12345ab - contains six numerical characters and end with one or two no numerical e.g.
123456aor123456ab
Here is my query:
SELECT * FROM Asset WHERE asset_n LIKE [\d{5,6}\w{1,2}]
The query return nothing... I have used the same regex pattern in PowerShell and it's working perfectly. SQL is something new for me so I don't realy know how to build my regex pattern for SQL query's.
Thanks in advance for your help.