Go Back   Garayed.com > mySQL
Reply
 
LinkBack Thread Tools Search this Thread Display Modes

Challenge: Search all fields in all tables for string
  #1 (permalink)  
Old 01-16-2009, 01:10 AM
javelin
 
Posts: n/a
Default Challenge: Search all fields in all tables for string

There are various reasons I'd like to do this, so I don't want to
detail that here. I can easily do this within a SQL Server stored
procedure, by creating a list of all tables, and for each table, run a
search to list of all fields, then run a query on the current table in
the current field for a parameter. Then, I would move on to the next
one. However, I'm not sure how to do that in MySQL. Any helpful code
available out there? I'm not sure quote how to google this one, so I
keep coming up with junk.

Thanks.

J
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Re: Challenge: Search all fields in all tables for string
  #2 (permalink)  
Old 01-16-2009, 01:23 AM
Michael Austin
 
Posts: n/a
Default Re: Challenge: Search all fields in all tables for string

javelin wrote:
> There are various reasons I'd like to do this, so I don't want to
> detail that here. I can easily do this within a SQL Server stored
> procedure, by creating a list of all tables, and for each table, run a
> search to list of all fields, then run a query on the current table in
> the current field for a parameter. Then, I would move on to the next
> one. However, I'm not sure how to do that in MySQL. Any helpful code
> available out there? I'm not sure quote how to google this one, so I
> keep coming up with junk.
>
> Thanks.
>
> J



look at the stored proc in sqlserver... and then:
http://dev.mysql.com/doc/refman/5.0/...on-schema.html
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Re: Challenge: Search all fields in all tables for string
  #3 (permalink)  
Old 01-16-2009, 02:14 AM
Charles Polisher
 
Posts: n/a
Default Re: Challenge: Search all fields in all tables for string

Michael Austin <maustin@firstdbasource.com> wrote:
> javelin wrote:
>> There are various reasons I'd like to do this, so I don't want to
>> detail that here. I can easily do this within a SQL Server stored
>> procedure, by creating a list of all tables, and for each table, run a
>> search to list of all fields, then run a query on the current table in
>> the current field for a parameter. Then, I would move on to the next
>> one. However, I'm not sure how to do that in MySQL. Any helpful code
>> available out there? I'm not sure quote how to google this one, so I
>> keep coming up with junk.


> look at the stored proc in sqlserver... and then:
> http://dev.mysql.com/doc/refman/5.0/...on-schema.html


Use mysqldump to generate a flat file, then grep for the desired data.

QED, HAND,
--
Charles Polisher
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Re: Challenge: Search all fields in all tables for string
  #4 (permalink)  
Old 01-16-2009, 02:14 AM
Charles Polisher
 
Posts: n/a
Default Re: Challenge: Search all fields in all tables for string

Michael Austin <maustin@firstdbasource.com> wrote:
> javelin wrote:
>> There are various reasons I'd like to do this, so I don't want to
>> detail that here. I can easily do this within a SQL Server stored
>> procedure, by creating a list of all tables, and for each table, run a
>> search to list of all fields, then run a query on the current table in
>> the current field for a parameter. Then, I would move on to the next
>> one. However, I'm not sure how to do that in MySQL. Any helpful code
>> available out there? I'm not sure quote how to google this one, so I
>> keep coming up with junk.


> look at the stored proc in sqlserver... and then:
> http://dev.mysql.com/doc/refman/5.0/...on-schema.html


Use mysqldump to generate a flat file, then grep for the desired data.

QED, HAND,
--
Charles Polisher
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Re: Challenge: Search all fields in all tables for string
  #5 (permalink)  
Old 01-16-2009, 10:21 AM
Captain Paralytic
 
Posts: n/a
Default Re: Challenge: Search all fields in all tables for string

On 16 Jan, 02:10, javelin <google.1.jvm...@spamgourmet.com> wrote:
> There are various reasons I'd like to do this, so I don't want to
> detail that here. I can easily do this within a SQL Server stored
> procedure, by creating a list of all tables, and for each table, run a
> search to list of all fields, then run a query on the current table in
> the current field for a parameter. Then, I would move on to the next
> one. However, I'm not sure how to do that in MySQL. Any helpful code
> available out there? I'm not sure quote how to google this one, so I
> keep coming up with junk.
>
> Thanks.
>
> J


Sounds like you need to normalise your design
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Re: Challenge: Search all fields in all tables for string
  #6 (permalink)  
Old 01-18-2009, 11:54 PM
jmh
 
Posts: n/a
Default Re: Challenge: Search all fields in all tables for string

On 2009-01-16, javelin <google.1.jvmail@spamgourmet.com> wrote:
> There are various reasons I'd like to do this, so I don't want to
> detail that here. I can easily do this within a SQL Server stored
> procedure, by creating a list of all tables, and for each table, run a
> search to list of all fields, then run a query on the current table in
> the current field for a parameter. Then, I would move on to the next
> one. However, I'm not sure how to do that in MySQL. Any helpful code
> available out there? I'm not sure quote how to google this one, so I
> keep coming up with junk.
>
> Thanks.
>
> J
>
>
> ---
> avast! Antivirus: Inbound message clean.
> Virus Database (VPS): 090117-0, 01/17/2009
> Tested on: 1/18/2009 7:50:37 PM
> avast! - copyright (c) 1988-2009 ALWIL Software.
> http://www.avast.com


I'm not sure how efficient this would be but the COLUMNS table in
the INFORMATION_SCHEMA database will let you know the table name,
column and and data type of the column for each of the databases you
have.

Should give you all the information you need to do that type
of general string seach within a storeed procedure.

jmh

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 02:35 AM.


Powered by vBulletin® Version 3.5.8
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
| Home | FAQ | Members List | Calendar | Today's Posts | Search | New Posts |