like-operator

What is a suitable replacement for the SQL Like operator to increase performance?

I'm working on an application that runs on Windows Mobile 6 that needs to be able to retrieve all items from an item table that contain a given string (provided by the end user) within the item's description field. The problem is that there are approximately 170,000 items in the table. Since I need to return all items that contain the st...

Sqlite + 80K rows + LIKE = keyboard lag

I've had this problem that I have been putting off solving, but now is the time. I have a basic dictionary program. It has a UISearchBar and a UITableView. It works the way that it should except when running on the device it causes Keyboard lag. (Simulator is fine, of course) I have two types of searching. As-you-type and On-return. I f...

C# DataView Date Range with LIKE Operator?!?

I have an XML file: <SMS> <Number>+447761692278</Number> <DateTime>2009-07-27T15:20:32</DateTime> <Message>Yes</Message> <FollowedUpBy>Unassigned</FollowedUpBy> <Outcome></Outcome> <Quantity>0</Quantity> <Points>0</Points> </SMS> <SMS> <Number>+447706583066</Number> <DateTime>2009-07-27T15:19:16</...

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...

SQL query for a carriage return in a string and ultimately removing carriage return

SQL query for a carriage return in a string and ultimately removing carriage return I have some data in a table and there are some carriage returns in places where I don't want them. I am trying to write a query to get all of the strings that contain carriage returns. I tried this select * from Parameters where Name LIKE '%"\n" %' A...

USING THE SQL LIKE OPERATOR WITH %%

I had a requirement to create a query in MS SQL where the search condition would include/exclude a table based on user input. Say I have two tables’ TABLE_A and TABLE_B with columns KEYCOLUMN_A, COLUMN_A in TABLE_A and columns FKCOLUMN_B, COLUMN_B in TABLE_B And a query like SELECT TABLE_A.* FROM TABLE_A, TABLE_B WHERE TABLE_A.KEYCOLU...

"LIKE" does not work as expected

In Postgresql 8 why this is ok select * from prod where code like '1%' select * from prod where code like '%1' but this returns 0 rows (there are codes begining/ending with digit 1) select * from prod where code like '1%1' Update That happens in my current instalation: # psql --version psql (PostgreSQL) 8.3.7 create table a(co...

How to use SQL LIKE

Hello, I am trying to filter results in an sql query using the like statement. Here are the results /q/my_rat_terrior_is_about_8_just_this_moring_hes_barley_moving_around_panting_heavy_and_shaking_like_shivering/1 /addquestion /addquestion/Validation /q/how_do_you_get_a_hamster_out_of_a_wall/2 These are urls that are stored in my data...

SQL Server datetime LIKE select ?

in MySQL select * from record where register_date like '2009-10-10%' What is the syntax in SQL Server? Thank you. ...

using LIKE with logical operators

i can't seem to figure out how to combine LIKE with an OR or AND: DELETE * FROM persons WHERE FirstName = 'Abe' AND LastName LIKE '%coln'; Looks like it should owrk to me but I get error 1064 (syntax0 Is there a correct way to do this? ...

Oracle query using 'like' on indexed number column, poor performance.

On Query 1 a full table scan is being performed even though the id is an indexed column. Query 2 achieves the same result but much faster. If Query 1 is run returning an indexed column then it returns quickly but if non-indexed columns are returned or the entire row is then the query takes longer. In Query 3 it runs fast but the column...

LIKE operator for Progress DB SQL

I'm trying to do something like this in Progress SQL (THIS IS NOT POSTGRES!) SELECT CASE WHEN code LIKE '%foo%' THEN 'Y' ELSE 'N' END as foo FROM bar However Progress does not support a LIKE operator. INSTR looks like it might do the job, but it is a Progress extension an isn't supported on the DB I am using. Is there another ...

Can MySQL fulltext search be adapted to search for partial words?

I implemented MySQL fulltext search and worked perfect. Now the client wants that partial matches be found by the search, for example the term 'base' should match 'database'. I know the whole idea of fulltext search is based on word delimiters, and searching for full words. I know I most likely will have to use an undesirable LIKE '%$ter...

LIKE operator with $variable

This is my first question here and I hope it is simple enough to get a quick answer! Basically, I have the following code: $variable = curPageURL(); $query = 'SELECT * FROM `tablename` WHERE `columnname` LIKE '$variable' ; If I echo the $variable, it prints the current page's url( which is a javascript on my page) Ultimately, what I...

Hibernate HQL query by using like operator

Hi, Seu the following mapping @Entity public class User { private Integer id; @Id; private Integer getId() { return this.id; } } Notice id is an Integer. Now i need this HQL query by using like operator Query query = sessionFactory.getCurrentSession().createQuery("from User u where u.id like :userId"); A...

Query SQL with like operator from two tables

How can I do a SQL query with the like operator from two different tables? I need something like: select * from table1 where name like %table2.name It's not a common field but a substring of a field on another table. ...

Query sql with like operator from two tables

I need something like: select * from table1 where name like %table2.name ...

How to Filter ADO.NET data using a Full Text Seach (FTS) field?

Hi All, We are using ADO.NET dataservices & are building URL based filters. Example: /Customers?filter=City eq 'London' We now need to filter on a Full Text 'tags' Field. WAS HOPING FOR: /Customers?filter=Tag like 'Friendly' PROBLEM: ADO.NET does not have a LIKE operator. ADO.NET does not seem to like FTS (It is not finding a match - b...

filter mySQL database with multiple words in any order in Concatenated field

I have Concatenated in mySQL to produce a field that I can search with. This contains animal as well as owner names and addresses for a client database. I need to be able to search by animal name, owner names and postcode in any order. Thus if if my name is john smith and i own a dog called Fido and live in postcode AB1 2CD, I want the s...

MySQL: Which is faster — INSTR or LIKE?

If your goal is to test if a string exists in a MySQL column (of type 'varchar', 'text', 'blob', etc) which of the following is faster / more efficient / better to use, and why? Or, is there some other method that tops either of these? INSTR( columnname, 'mystring' ) > 0 vs columnname LIKE '%mystring%' ...