Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
asifbhura
Posting Yak Master
165 Posts |
Posted - 2009-12-22 : 04:32:31
|
| Hi,I want to search text in 2 or more than 2 columns at timei did like below it works, i want solutions better than that,normally we search only in one columns as likeSELECT * FROM News WHERE news_detail like '%USA%'but for 2 more than two i tried like belowplease give me better solutionSELECT * FROM News WHERE news_detail like '%USA%' UNIONSELECT * FROM NEWS where news_title like '%USA%' |
|
|
rajdaksha
Aged Yak Warrior
595 Posts |
Posted - 2009-12-22 : 04:37:38
|
| HIIf you using SQL SERVER 2008 You can use the CONTAINS predicate to query multiple columns by specifying a list of columns to search. Note The columns must be from the same table.-------------------------R... |
 |
|
|
Sachin.Nand
2937 Posts |
Posted - 2009-12-22 : 08:20:20
|
| Why use a union?U can use something like thisSELECT * FROM News WHERE (news_detail like '%USA%')OR(news_title like '%USA%')PBUH |
 |
|
|
|
|
|