开发者

What is the sql statement for searching in text using MS SQL Server 2008?

开发者 https://www.devze.com 2023-01-01 19:14 出处:网络
If I have text sotred in my DB, for example: \"There are 2 books on the table\". Maybe the user wants to search for \"books\" or the user wan开发者_JAVA百科ts to search in this text for any thing.

If I have text sotred in my DB, for example:

"There are 2 books on the table".

Maybe the user wants to search for "books" or the user wan开发者_JAVA百科ts to search in this text for any thing.

What is the best SQL Statement to do that?.

Thanks in advance.


SELECT ... WHERE COL LIKE '%books%'

For more complicated scenarios you might want to investigate Full Text Search


I think you are looking for a 'like' clause if I understand your question. so

select * from table where column like '%book%'


like this

WHERE ColumnName LIKE '%books%'

or look into full text search if you need to do more complicated stuff

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号