1

The question was already asked here,

Pervasive SQL query

but never answered.

Can somebody help to create a query that will search the entire database for a specific value?

Sorry, I can't comment on the previous question as I am a new user and don't have enough reputation to do so.

Mark
  • 11
  • 3

1 Answers1

0

There is not a built-in way to search every single column for a specific value.

I'm not exactly sure why you want to search every single column for a specific value. Seems a little excessive in terms of the performance hit on the database.

If you really need to do this, the best suggestion I can give would be to write a stored procedure that iterates all of the tables, then iterates all of the fields in each table to use them in the WHERE clause. A better way to do it would be to build the query using the fields where the value is like to be. For example, if you're trying to search all the tables for a specific ID, you probably don't need to search date or currency or quantity fields. How you do this will also depend on the version of PSQL you're using.

If you explain what you hope to accomplish and why you need it, we might be able to offer better suggestions.

mirtheil
  • 8,952
  • 1
  • 30
  • 29
  • Thanks mirtheil. The database is relatively small at the moment. I have exported all tables that I thought may contain what I was after. I then searched for a specific value and I couldn't find it. Is there a way for the company who wrote the database to somehow hide or encapsulate the data? Maybe they are using a formula to come to the value I am trying to find? – Mark May 21 '16 at 02:20
  • Would you be willing to assist me in finding the data I am after? Maybe I can post a project on Freelancer.com for you? – Mark May 21 '16 at 02:24
  • To answer the question about hiding the data, it depends. Almost anything can be encrypted and stored in a database. I would be open to discussing a project. – mirtheil May 21 '16 at 02:47
  • I have tried contacting you on mirtheil.com but an error is returned. What is your rate for connecting via teamviewer and trying to find the data I am looking for? – Mark May 21 '16 at 03:18
  • I'd like a little more information about the project. Try the website again – mirtheil May 21 '16 at 03:38