This post originated from an RSS feed registered with .NET Buzz
by Peter van Ooijen.
Original Post: SELECT LIKE %
Feed Title: Peter's Gekko
Feed URL: /error.htm?aspxerrorpath=/blogs/peter.van.ooijen/rss.aspx
Feed Description: My weblog cotains tips tricks and opinions on ASP.NET, tablet PC's and tech in general.
The catch is what happens when an empty parameter is passed in. Which will result in a query which looks like
SELECT Naam, Afkorting FROM dbo.Persoon WHERE (Naam LIKE '%') AND (Functie LIKE '%')
At first sight the query will return all rows. It does not. It will return al rows which do contain a value for the Naam and the Functie column. % matches any text but does not match a dbNull value. Makes sense. But was a catch.