Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query: SQL LIKE statement (wildcards) using LINQ #6159

Closed
axelheer opened this issue Jul 25, 2016 · 7 comments
Closed

Query: SQL LIKE statement (wildcards) using LINQ #6159

axelheer opened this issue Jul 25, 2016 · 7 comments

Comments

@axelheer
Copy link
Contributor

In the "old" Entity Framework it was possible to use SqlFunctions in order to create something like an ordinary LIKE statement.

... where SqlFunctions.PatIndex("%na_f%", x.Name) > 0...

While in the "new" Entity Framework there seems to be no replacement for SqlFunctions. That approach was a workaround anyway, but some way to use a simple LIKE statement would be very useful. If not essential.

@divega
Copy link
Contributor

divega commented Jul 25, 2016

Related to #2850.

@rowanmiller rowanmiller changed the title Create classic SQL LIKE statement (wildcards!) using LINQ Query: SQL LIKE statement (wildcards) using LINQ Jul 25, 2016
@rowanmiller rowanmiller added this to the Backlog milestone Jul 25, 2016
@smitpatel
Copy link
Contributor

@anpete - Is this same as in-memory like we have?

@axelheer
Copy link
Contributor Author

Oh, we have EF.Functions.Like now. 🤘

@bricelam bricelam modified the milestones: Backlog, 2.1.0 Jan 2, 2018
@ajcvickers ajcvickers removed this from the 2.1.0-preview1 milestone Apr 26, 2018
@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
@irg1008
Copy link

irg1008 commented May 10, 2024

How can we use the patindex function now? Or could I get the index in which like or match pattern happens?

@roji
Copy link
Member

roji commented May 11, 2024

@irg1008 take a look at the comment just above.

@irg1008
Copy link

irg1008 commented May 11, 2024

Yeah but Like does not return the index and used inside where, I need to know the index to get a substring of a column value

@roji
Copy link
Member

roji commented May 11, 2024

Thanks, I misread your comment. EF Core doesn't current have a translation for SQL Server PATINDEX, I opened #33702 to track that. In the meanwhile, if you need this, you should be able to use user-defined function mapping to map a .NET method stub of your own to PATINDEX.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants