Page 1 of 1
SIMILAR TO pattern matching
Posted: Tue 04 Sep 2012 23:36
by yozey
Is there be support in Linq to PostgreSQL for their SIMILAR TO pattern matching operator?
Re: SIMILAR TO pattern matching
Posted: Wed 05 Sep 2012 10:46
by MariiaI
You could use SqlMethods.Like method, which is translated into SQL command 'LIKE'. The 'SIMILAR TO' operator is not supported, because there are no methods, that could be translated into it. Thus, if you are using any complex regular expressions, you can only write commands manually and perform them via the ExecuteQuery() method (
http://www.devart.com/linqconnect/docs/ ... Query.html).
Example of using SqlMethods.Like:
Code: Select all
YourDataContext context = new YourDataContext();
var query = from c in context.Depts where Devart.Data.Linq.SqlMethods.Like(c.Dname, "SALES") select c;
Please tell us if this helps.
Re: SIMILAR TO pattern matching
Posted: Wed 05 Sep 2012 13:32
by yozey
Thanks for your reply. I will use the ExecuteQuery method.