Question:
SQL string search question?
dinkyrpg
2008-05-29 09:31:46 UTC
Is it possible to scan a tables field value for individual strings?

for instance... if this was listed ..

ID / Keyword / Description
1 / Hello / +1+2+3+4+5+6

could i search the description value for +5 and return true?

also, added on to that, is it possible to add a +7 to the end of that value without erasing the data easily?

thanks
Six answers:
ali_fakoor
2008-05-29 09:43:44 UTC
Here is first query:



SELECT * from MyTableName

WHERE desctiption

LIKE '%+5%'





about the second part I am not sure right now.
David K
2008-05-29 17:31:34 UTC
For the 2nd part of your question



UPDATE yourTable

Set Description = Description + '+7'

WHERE ID=1
Serge M
2008-05-29 19:45:38 UTC
>is it possible to add a +7 to the end of that value



Update table_name

set Description=Description + '+7'

where id=1



By the way, you should reconsider the design.
anonymous
2008-05-29 16:42:26 UTC
Have u try full-text search feature ?
anonymous
2008-05-29 16:42:55 UTC
http://dev.mysql.com/doc/refman/5.0/en/fulltext-search.html
anonymous
2008-05-29 16:49:51 UTC
http://blogs.technet.com/reeds/archive/2007/01/12/full-text-search-using-a-column-that-contains-a-list-of-keywords.aspx

http://www.kodyaz.com/articles/SQL-Server-Full-Text-Search-Indexing.aspx

http://www.sitepoint.com/blogs/2006/12/06/sql-server-full-text-search-protips-part-2-contains-vs-freetext/

http://www.sitepoint.com/blogs/2006/12/30/sql-server-full-text-search-protips-part-3-getting-ranked/


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...