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 |
|
ossama
Starting Member
2 Posts |
Posted - 2007-12-24 : 08:22:45
|
hello, this is my first post here, i have a table with many columns (i am using ms access) and i want to search for a word in all columns, how can i use SELECT WHERE LIKE against all the columns at once (not against each coloumn)SELECT * FROM MyTable WHERE (all the columns in the table) LIKE '%What_I_Am_Searching%' thank you in advance |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
|
|
ossama
Starting Member
2 Posts |
Posted - 2007-12-24 : 08:47:13
|
| i am new in sql, the script in that page is very complicate to me, i habituated myself in simple queries against a database (i am using queries using ODBC functions like SQLExecDirect) |
 |
|
|
georgev
Posting Yak Master
122 Posts |
Posted - 2007-12-25 : 18:14:00
|
Unfortunately there is no such thing as a LIKE IN comparison... however they do exist separately[CODE]DECLARE @searchStr char(6)SET @searchStr = 'George'SELECT *FROM myTableWHERE field1 LIKE '%' + @searchStr + '%'OR field2 LIKE '%' + @searchStr + '%'...OR fieldN LIKE '%' + @searchStr + '%'SELECT *FROM myTableWHERE @searchStr IN (field1, field2 ... fieldN)[/CODE] George<3Engaged! |
 |
|
|
|
|
|