473,786 Members | 2,849 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

LIKE % Operator

Dear all,

I want to perform a simple search for a query such as:

SELECT *
FROM SOME_TABLE
WHERE SOME_TABLE.SOME _COLUMN LIKE '%SOME_KEYWORD% '

The same statement if implemented in a stored procedure would look
similar like this:
CREATE PROCEDURE sp_FindKeyword (IN SOME_KEYWORD AS VARCHAAR(55))
BEGIN
SELECT *
FROM SOME_TABLE
WHERE SOME_TABLE.SOME _COLUMN LIKE '%' + SOME_KEYWORD + '%' ;
END

But this does't work ....
I know I could manipulate the '%' before passing the parameter using
the interface language such as php, asp, ..etc. but is there a way this
can be done using MySql 5 itself?

Best regards

Jan 13 '06 #1
2 1512
"coosa" <co*****@gmail. com> wrote in message
news:11******** *************@f 14g2000cwb.goog legroups.com...
WHERE SOME_TABLE.SOME _COLUMN LIKE '%' + SOME_KEYWORD + '%' ;


MySQL uses the CONCAT() function to concatenate string. For example:

WHERE SOME_TABLE.SOME _COLUMN LIKE CONCAT('%', SOME_KEYWORD, '%')

String concatenation, strangely, is nonstandard in many RDBMS
implementations . In the ANSI SQL standard, the string concatenation
operator is ||, but few RDBMS's seem to do it that way.

Regards,
Bill K.
Jan 13 '06 #2
Thanks

Jan 14 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
2343
by: Arvid Andersson | last post by:
Hello, I need to convert a string to a number, but the string can contain +,-,* and / as well as parenthesis. For example, if I have the string "30/(6+9)" I would like a function that returned the number 2. I actually wrote a java function that did this a couple of years ago, in school, as an excersise in "binary trees". I lost it, and most of my programming knowledge, but I figured perhaps there is a way to do this easily in python? It...
0
1597
by: Jason Heyes | last post by:
I wrote a previous post that asked whether there was a reference-counted implementation of std::vector. Apparantly there wasn't. So my next question is, is it possible to write your own shared container that behaves like std::vector? Here is me trying to answer that question: class FooReference;
5
3808
by: Jason | last post by:
Hello. I am trying to learn how operator overloading works so I wrote a simple class to help me practice. I understand the basic opertoar overload like + - / *, but when I try to overload more complex operator, I get stuck. Here's a brief description what I want to do. I want to simulate a matrix (2D array) from a 1D array. so what I have so far is something like this: class Matrix
3
3596
by: Markus Dehmann | last post by:
I have a two different value types with which I want to do similar things: store them in the same vector, stack, etc. Also, I want an << operator for each of them. class Value{}; // this would be "public interface Value{}" in Java! class IntValue : public Value{ private: int _value; public:
9
2760
by: Rich Herrick | last post by:
The latest version of my "Pascal-like" set class is available here: http://www.richherrick.com/software/herrick-1.0.zip Those from the old YAHOO BOOST forum might remember it from several months back. I have enhanced the code, and "deboostifized" it. For those unfamiliar with it, it is a template class that implements set classes that are similar to the set type in the Pascal language. Like Pascal, any integer (ordinal) type may...
2
6008
by: Ed Brown | last post by:
I'm working on a VB.Net application that needs to do quite a bit of string pattern matching, and am having problems using the "LIKE" operator to match the same string twice in the pattern. For example, in the following code: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim theString As String theString = "1234 TEST 5432 TEST ABCD" If theString Like "*TEST*TEST*" Then...
12
1990
by: ex_ottoyuhr | last post by:
I have a situation more or less as follows, and it's causing me no end of trouble; I'd appreciate anyone's advice on the matter... Given these classes: class BedrockCitizen { ... }; class Fred : public BedrockCitizen { ... }; class Wilma : public BedrockCitizen { ... }; class Barney : public BedrockCitizen { ... };
2
1306
by: Piotr Sawuk | last post by:
What is wrong with the following? Why doesn't it compile? template<int f, class me, typename ValType=int> class Fm { protected: ValType v; public: me& operator+=(const me& o) {v=((me*)this)->operator+(o); return *(me*)this;} me& operator*=(const me& o) {v=((me*)this)->operator*(o); return *(me*)this;}
4
1703
by: Christian Schmidt | last post by:
Hi all, I'm trying to implement a std::vector-like wrapper for IList. The hard part seems to be operator, because it returns an unmanaged reference. Probably I have to use pin_ptr to achieve this, but I don't know how. Can anybody help? Thanks, Christian
5
2866
by: simudream | last post by:
//hi maybe helpful others can look at this code and //tell me why the class code won't behave like //intrinsic types with post and pre increment //Version: 1.00 #include <iostream> using std::cout; using std::endl; using std::ostream;
0
9496
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10363
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10110
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9961
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8989
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7512
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4066
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3669
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.