Do you have a question? Post it now! No Registration Necessary. Now with pictures!
January 13, 2006, 9:33 pm
rate this thread
I want to perform a simple search for a query such as:
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))
WHERE SOME_TABLE.SOME_COLUMN LIKE '%' + SOME_KEYWORD + '%' ;
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?
Re: LIKE % Operator
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.
- » Americanas.com SALDO de TVs Com at 80% de Desconto (29798)
- — Newest thread in » MySQL Database Forum