like-operator

Like operator in sql server

I want to get all the record from the one table which contain atleast one word from the input string. Ex: input parameter='Stack over flow': select * from sample where name like '%stack%' or name like '%over%' or name like '%flow%' I want to search record which contains 'stack' or ' over' or 'flow' ... ...

Search for string within text column in MySQL

I have mysql table that has a column that stores xml as a string. I need to find all tuples where the xml column contains a given string of 6 characters. Nothing else matters--all I need to know is if this 6 character string is there or not. So it probably doesn't matter that the text is formatted as xml. Question: how can I search wi...

Linq.Where-to-SQL on a text field comparing to a list of values

Customer.text is a field in an T-SQL DB (that I do not control and thus may not alter) of type "text". I'd like to do something like this: List<string> compare = new List<string>(); compare.Add("one"); compare.Add("two"); var q = from t in customer where t.text.Contains( compare.First()) select t; this will work. Bu...

Linq2SQL to produce Like operator

Hi, I have a string "Word1 Word2" and I want to transform it to a query such as "Like '%Word1%Word2%'". At the moment I have: from t in Test where t.Field.Contains("Word1 Word2") How to do this in LINQ2SQL? Do I need to create two separate queries for this, can't I write it in the same statement? Thx in advance ...

SQL Like question

Is there a way to reverse the SQL Like operator so it searches a field backwards? For example, I have a value in a field that looks like this "Xbox 360 Video Game". If I write a query like below, it returns the result fine. SELECT id FROM table WHERE title like "%Xbox%Game%" However, when I search like this, it doesn't find any resu...

Exact match with sql like and the bind

I have a bind in the sql query (select * from users where name like '%?%') the bind set the ? Now, if i want to search with like method everything work but if, without change the sql, i want to search the exact match i dont now how to do. I tried some regexp int the textbox es: _jon \jon\ [jon] and some others but nothing work properly....

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

MySQL Query like not returning correct results

Hello friends, i've a MySQL query that should return some rows that have the letters Ö or Ü in it but it actually does not. The query code is this: $this->db->like('title', $text ); It's PHP CodeIgniter active query. Lets assume we have 2 rows. 1. Büm 2. Bom if i search for Bü, the 1. row has to be returned but it does not. When...

Active User Tracking, PHP Sessions

Alright, I'm trying to work on a function for active user counting in an AJAX based application. I want to express the below SQL Query in correct syntax but I'm not sure how to write it. The desired SQL Query is below: SELECT count(*) FROM active WHERE timestamp > time() - 1800 AND nick=(a string that doesn't contain [AFK]) Now, ...

Using LIKE operator in LINQ to Entity

Hi, everybody! Currently in our project we are using Entity Framework and LINQ. We want to create a search feature where the Client fills different filters but he isn't forced to. To do this "dynamic" query in LINQ, we thought about using the Like operator, searching either for the field, or "%" to get everything if the user didn't fil...

Create SQL 'LIKE' Statment that looks for specific Patterns of numbers and letters

Is it possible to use LIKE in a SQL query to look for patterns of numbers and letters. I need to locate all records where the specific field data has the pattern (2 Numbers,1 hyphen, 3 Letters) ## - AAA I am using SSMS with SQL Server 2008. Any help would be appreciated. THANKS. ...

SWITCH with LIKE inside SELECT query in MySQL-Resolved

I have this Tags table CREATE TABLE IF NOT EXISTS `Tags` ( `id_tag` int(10) unsigned NOT NULL auto_increment, `tag` varchar(255) default NULL, PRIMARY KEY (`id_tag`), UNIQUE KEY `tag` (`tag`), KEY `id_tag` (`id_tag`), KEY `tag_2` (`tag`), KEY `tag_3` (`tag`), KEY `tag_4` (`tag`) ) ENGINE=InnoDB DEFAULT CHARSET=l...

sql server 2008 LIKE performance

I've noticed that the first sql statement with LIKE on a large table runs very slowly (around 20 minutes) but every subsequent one very very fast (a few seconds), even if the strings searched for are completely different from the initial one (the first string 'ability%', the second 'su_mit%') Does sql server store the results of table ...

Performance of Like '%Query%' Vs Full Text Search CONTAINS Query

I have a situation where I would like to search single word. For that scenario, which Query would be good from performance point of view? Select Col1, Col2 from Table Where Col1 Like '%Search%' Or Select Col1, Col2 from Table Where Col1 CONTAINS(Col1,'Search') ...

SQL Server query using LIKE has problems with spaces under VBScript

[Withdrawing question: the issue arose from not escaping values submitted in web form. The ASP script removed unescaped spaces thereby causing the problem.] In a web page I am attempting to conduct a search against a table in MS SQL Server using VBScript. The search uses a LIKE clause (with wildcards). The search works fine if the input...

Easy SQL Syntax NOT LIKE with AND operators seem to be ignored

Thank you so much for helping! Nothing I seem to do works here. What I want to do is remove rows with a certain value in a certain column. Like so: Where SegStart_Date between getdate()-90 and getdate()-1 And q.Center not like 'Collections Center' And q.Center not like 'Cable Store' And q.Center not like 'Business Services C...

Are there any advantages to using the VB.NET Like Operator vs a RegEx?

Other than perhaps enhanced readability for very simple patterns, why would someone choose to use the Like operator in VB.NET over regular expressions for string pattern matching? Are there any advantages? ...

perl, dbi with sql statement with a like condition

hi all, in my code i must do a simple sql query with a like condition. i've do in this way my $out = "/Users/zero/out.log"; my $filename = "/Users/zero/data.txt"; my $dbh = DBI->connect("DBI:Oracle:sid=$sid;host=$host;port=$port", $user, $pwd) or die "Couldn't connect to database: " . DBI->errstr; my $query = "select SOMETHING from SO...

How to query mongodb with "like" ?

I'm using mongodb 1.4. I want query something as SQL's like. For an example in SQL: select * from users where name like '%m%' How to do the same in mongodb? I can't find a operator for like in the document of http://www.mongodb.org/display/DOCS/Advanced+Queries ...

How to query lucene with "like" operator?

The wildcard * can only be used at the end of a word, like user*. I want to query with a like %user%, how to do that? ...