like-keyword

SqlServer: Like vs. "=" for matching strings

Whenever I write a stored procedure for selecting data based on string variable (varchar, nvarchar, char) I would have something like: procedure dbo.p_get_user_by_username( @username nvarchar(256) as begin select u.username ,u.email --,etc from sampleUserTable u where u.username = @username...

List of special characters for SQL LIKE clause

What is the complete list of all special characters for a SQL (I'm interested in SQL Server but other's would be good too) LIKE clause? E.g. SELECT Name FROM Person WHERE Name LIKE '%Jon%' SQL Server: % _ [specifier] E.g. [a-z] [^specifier] ESCAPE clause E.g. %30!%%' ESCAPE '!' will evaluate 30% as true ' characters need to be esca...

Query related data based on "like" statement

I have two tables Table1: ColumnA (varchar) Table2: ColumnB (varchar) I need to get all rows from T2 where ColumnB is "like" any of the rows from 'ColumnA%'. For example, rows in T1 might be: Summer09 Fall09 while rows in T2 might be Spring09 Com101 Sec1 Summer09 Stat400 Sec2 Fall09 CS200 Sec3 In that scenario it would retun...

Why does LIKE not return rows for variables with '%' at end?

I find this quite odd on Microsoft SQL Server: SELECT * FROM deliveries WHERE code LIKE '01999195000%' -- 9 rows returned. Works. DECLARE @a VARCHAR(10) SET @a='01999195000%' SELECT * FROM deliveries WHERE code LIKE @a -- 0 rows returned? Why not? SET @a = '01999195000' SELECT * FROM deliveries WHERE code LIKE @a + '%' -- 9 rows retur...

Linq LIKE functionality

so.. I'm using LinqToEntities, and I want to query part of a field. Normally I'd use the LIKE keyword with SQL, and then go from there.. I see that Linq does not have it.. Whats a good way to get the same kind of functionality? ...

Is there an equivalent to PostgreSQL's WildSpeed for Sql Server?

Wildspeed: http://www.sai.msu.su/~megera/wiki/wildspeed Looks like a great way to do Like '%term%' matching in a fast efficient way, albeit with huge indexes. I'm looking for something similar for Sql Server. Full Text Search is not working for partial word matches, so please don't suggest that unless you have a way to use Full Text ...

How to develop a keyword matching application

I'll list what I'm planning to do and need pointers on how to go about building it. I have millions of business records. New businesses are added everyday. Every time a new Business is added, we need to determine if the particular business already exists. We query our database and search for businesses with matching keywords as entered ...

Searching for newlines in a Oracle DB using SQL 'like' clause

I'm trying to see if a particular column in a table in my Oracle database has any strings which contain a newline character, so a wildcard, a newline, and another wildcard. I've tried the like command and a combination with CHR(10) and tried escaping the newline itself, but to no avail. What would be the proper way to detect a newline ...