Avatar of tonelm54
tonelm54
 asked on

Find value

I have a database Im trying to reverse engineer. Is it possible to search all tables, and then all fields the values for a particular value?

Im thinking it would have to be a PowerShell script, but no idea where to start. I think it would have to be something like:-
$dbConnection = msql_connect("localhost","SA","myPassword","myDBInstance")
foreach ($table in $db_Connection) {
     foreach ($field in $table) {
          if $dbConnection.sql "Select count(*) from $table where `$filed` = 'myValue''" > 0 {
               response-write "Found value in $table.$field
           }
     }
}

Open in new window


Any ideas where to even start on this (excluding google :-) )

Thank you
Microsoft SQL ServerPowershell

Avatar of undefined
Last Comment
Jason clark

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Uptime Legal Systems

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Jason clark

You should go this one here you may find the help as per your need. Hope will be helpful http://thesitedoctor.co.uk/blog/search-every-table-and-field-in-a-sql-server-database-updated/
Your help has saved me hundreds of hours of internet surfing.
fblack61