I have done something like that. I used two connections to the database. The first "outer" connection retrieved the column names from the system table. On DB2 this was Select name from sysibm.syscolumns where tbname = 'favorate_table'; Then using Perl I made the calls to the table looking for the data I wanted in each column. So there were two separate DBI connections, one inside the other. Please note that you might have to check the column type as well, to check for CHAR or number columns. This will tell you to put ' or not around the values.
Let me know if my gibberish was not clear enough. Thanks, John W. Herbold Jr. IS Specialist/DBA -----Original Message----- From: Brad Smith [mailto:mata@;matatech.tzo.com] Sent: Tuesday, November 05, 2002 7:56 AM To: [EMAIL PROTECTED] Subject: SQL question I want to run a query that will perform a phrase search on all fields in the table. I thought that it seemed really logical to write the statement like: my $dbh = DBI->connect('dbi:ODBC:database_name') || die DBI::errstr; my $sth = $dbh->prepare("SELECT * FROM table_name WHERE * LIKE '%$in{'search term'}%' ORDER BY name "); $sth->execute(); while (($sid, $name)=$sth->fetchrow_array){ print qq~ .....truncated... ~; } $dbh->disconnect(); But I am wrong.... miserably, terribly wrong. Perhaps this is off topic, since it relates more to SQL than DBI, specifically, so please send any replies directly to [EMAIL PROTECTED] How would one run a phrase search across all the fields in a table? I am prepared for having to type 96 OR's if I have to do so, but I am regretting it nonetheless. ;) Thanks in advance. Brad Smith
