like

Best way to literal phrase search a text column in SQL Server

I thought full-text search would let me do exact phrase searching in a more optimized way than a LIKE predicate, but I'm reading that it doesn't do that exactly. Is "LIKE" the most efficient way to search thousands of rows of TEXT fields in a table for a literal string? It's got to be exact matching... ...

What is the best way to search the Long datatype within an Oracle database?

I am working with an Oracle database that stores HTML as a Long datatype. I would like to query the database to search for a specific string within the HTML data stored in the Long. I tried, "select * from TABLE where COLUMN like '%form%'". This causes the following Oracle error because "like" is not supported for Long datatypes. O...

Sql Server String Comparision

Is there any information as to how SQL Server compares strings and handles searching in them (like statments)? I am trying to find out if there is a way to determine how efficient it is to store information as a large string and use sql server to do a bunch of comparisons on rows to determine which match. I know this is potentially goi...

SQL `LIKE` complexity

Does anyone know what the complexity is for the SQL LIKE operator for the most popular databases? ...

SQL Server Index - Any improvement for LIKE queries?

We have a query that runs off a fairly large table that unfortunately needs to use LIKE '%ABC%' on a couple varchar fields so the user can search on partial names, etc. SQL Server 2005 Would adding an index on these varchar fields help any in terms of select query performance when using LIKE or does it basically ignore the indexes and d...

MySQL Fulltext Searching ideographic (Asian) characters

I have a database full of Asian-character filled records (Chinese, Japanese, and Korean) alongside those with Latin-character filled records (English, Français, you name it), and I want to perform fulltext searches on them. MySQL http://dev.mysql.com/doc/refman/5.1/en/fulltext-restrictions.html%29">says: Ideographic languages such a...

mysql query help (like statement)

I am using mysql which i have a stored procedure which has an input variable. I want to use this variable in a select statement (with like clause). Eg: DELIMITER $$ DROP PROCEDURE IF EXISTS `DeleteDataByTransactionID` $$ CREATE DEFINER=`root`@`%` PROCEDURE `DeleteDataByTransactionID`(in **$TransactionID** varchar(50)) BEGIN delete ...

mysql query works manually but returns no results when running from code

I use a very simple query with "Like" to find product by its name SELECT p_pid, p_name, p_cat FROM products WHERE p_sid=346 AND p_name LIKE 'product name here in utf-8 encoding, can be various languages' LIMIT 1 When I run this query from code with valid product name, I get no results. If I copy the query (echoed by php to the browser...

Performing an ASP.NET database search with StartsWith keyword

I have a query. I am developing a site that has a search engine. The search engine is the main function. It is a business directory site. A present I have basic search sql that searches the database using the "LIKE" keyword. My client has asked me to change the search function so instead of using the "Like" keyword they are after somet...

How to use the LIKE statement correctly in a MySql SELECT statement?

Why isn't this working? DELIMITER ;// CREATE PROCEDURE `blah` ( SearchText varchar(4000) ) BEGIN SELECT * FROM table_name WHERE table_name.StringField LIKE '%' + SearchText + '%'; -- This is where the code is breaking END;// ...

mysql query with like %..% in the where clause returning different results

I have the following problem (using mysql 5.0.70): In one table I have a varchar field containing some kind of a number - "0303A342", "21534463", "35663CE3", etc. Collation is set to utf8_general_ci. The problem shows up when a user of the system is trying to search for a record containing part of this number. SQL query looks like "...W...

like and not like in one mysql query

I want to do a query containing 'like' and 'not like'. Current example: i want everything starting with '1|%' but not with '1|6|199|%' or '1|6|200|%'. Current query: 'SELECT * FROM `links` WHERE `category` LIKE '1|%' NOT LIKE '1|6|199|%','1|6|200|%' ORDER BY `score` DESC LIMIT 9'. But that doesn't work. Any tips? thx ...

Executing SQL LIKE in SQLObject

Is there a pretty way to execute an SQL statement with a LIKE clause in SQLObject? This one: fields = Foo.select("field LIKE '%%%s%%'" % bar) works, but it's somewhat ugly. ...

c# Help joining textbox value, LIKE and a string variable

Hi all, What is wrong with my line below? table.DefaultView.RowFilter = cmbBox.Text + 'LIKE' + strName"; The line below works fine but is obviously no use. table.DefaultView.RowFilter = 'FirstName LIKE James'; Thanks ...

Flexible LIKE operator

I'm new to SubSonic. I've been looking for a way to use LIKE operator that let me build SQL query like this: select * from person where lastname like '%bob%', but I could not find a generic way to do this beside inserting string into the quey like q.OR(Person.Columns.FirstName, SubSonic.Comparison.Like, "%bob%"); that is not a prefered...

Using parameterized SQL with LIKE in WHERE clause (Pervasive SQL)

Hi all, I have a Pervasive database that I connect to using C++. All my queries so far is parameterized, i.e "SELECT USER.NAME FROM USER WHERE USER.ID = ?", and that works fine. But in a search query I use LIKE in the WHERE clause, and then it seems I can't use parameters and wild chars (%). My query looks something like this "SELECT ...

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

Mysql Like Syntax

Hi all, Quick question: How do I mysqli_escape_string a variable enclosed in a like clause? "SELECT * FROM table WHERE name LIKE '%". %s . "%'" or "SELECT * FROM table WHERE name like '%"."%s"."%'" don't work. Thanks! ...

Emulating SQL LIKE in JavaScript

How can I emulate the SQL keyword LIKE in JavaScript. For those of you who don't know what LIKE is, it's a very simple regex which only supports the wildcards %, which matches 0 or more characters, and _ which matches exactly one character. However, it's not just possible to do something like var match = new RegEx(likeExpr.replace("%",...

Parameter in like clause JPQL

Hi, I am trying to write a JPQL query with a like clause: ...LIKE '%:code%' I would like to have code=4 and find 455 554 646 ... I cannot pass :code = '%value%' namedQuery.setParameter("%" + this.value + "%"); because in another place I need :value not wrapped by the % chars. Any help? Thank you ...