Ask questions via twitter! Message any question to @answers on twitter. We'll publish the question and send you a reply each time there's a new answer.
Next Question

Answered Question

 
January 05, 2009 07:21 PM

Is there a way to search an entire database?

I am running PostGres SQL 8.2, using SQLManager Lite to view the DB.

Is there a function or query to write that will search the entire database for a text string (inside a column)? There are about 50 tables and going through them manually would be a nightmare.
Interesting Question?  Yes (0)   No (0)   
RSS
 
 

Best Answer  Chosen by Asker

 
January 05, 2009 08:01 PM
If you have Excel handy, you could copy and paste a bunch of select statements together for each of the tables.

For example, say in row 1, you have column A have the Table name, and column B the field name.

Column C you could have a formula something like:

="SELECT " && B1 && " FROM " && A1 "

Then copy this formula so that it appears down the line in column C for the rest of the entries.

Copy those into a PostGres command session (I don't think you could do this via SQLManager, you might need to do this manually).

Failing that, hopefully someone will answer with fresher knowledge of PostGres, or maybe someone who could suggest building some PHP or Perl script which could do something similar.


Helpful Answer?  (2)   (0)    Tip darth continent for this answer
Permalink | Report
   Reply  
 
 

Other Answers (2)

Sort By
 
January 06, 2009 01:10 AM
run a query

Helpful Answer?  (0)   (2)    Tip thenewyorker for this answer
Permalink | Report
   Reply  
 
 
 
January 08, 2009 04:10 PM
Is the column name the same in every table or do you want to search all the columns in all the tables?

Helpful Answer?  (0)   (0)    Tip abbotofunreason for this answer
Permalink | Report
   Reply  
 
 

Answer this Question

How tips and payments work

This question has already been resolved. You may add an answer to it but you will not be eligible to win best answer or any associated tips.

Ask a Question


140 characters left
Top of Page
Buy Mahalo Dollars with Credit Card or PayPal

Top Members

This Week All Time
  • buddawiggi
    buddawiggi
    2nd Degree Black Belt
    27933 Points
    M$806.66 Earned
  • opher
    opher
    Purple Belt
    4757 Points
    M$203.72 Earned
  • annelisle
    annelisle
    Purple Belt
    3308 Points
    M$99.72 Earned
   See All
 

Most Popular Tags

mahalo(1641)
iphone(468)
music(465)
google(361)
food(327)
online(298)
beer(281)
money(267)
movies(265)
apple(253)
aotd(235)
health(221)
video(210)
free(207)
dog(205)
   See All
 

Categories

Welcome New Members


 
 
Mahalo Dollars are the currency of Mahalo Answers.

Each Mahalo Dollar costs $1.

Once you earn more than 40 Mahalo Dollars, you can request to be paid via PayPal. Each Mahalo Dollar is currently worth $0.75 when paid out via PayPal. Learn More

 
 

Please log in to use this function.