Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SELECT statement

Status
Not open for further replies.

rhysmeister

Programmer
May 29, 2003
54
0
0
GB
I want a sql statement that basically says...

&quot;select all from <tablename> where <anycolumn> is like <condition>&quot;

Any ideas?
 
instead of the word &quot;all&quot;, use an asterisk

rudy
 
I don't mean the all section of the staement, basically I want to search all the columns in various tables for a keyword, something like...

SELECT * FROM <tablename> WHERE <allcolumns> LIKE <%keyword%>;
 
you will have to mention each column

where foo like '%zzz%'
or bar like '%zzz%'
or qux like '%zzz%' ...
 
Just thought there may have been a quicker way, thanks!

Rhys
 
It's tricky, but if you create a cursor (loop) and use the system tables (which is where you find the column names, etc) you can do this.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top