Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SP to explore tables and check data

Status
Not open for further replies.

RRinTetons

IS-IT--Management
Jul 4, 2001
333
US
I've got a script that I use to find the names of all tables that have a column named 'x', or 'x' and 'y', etc.

Once I've got that list I'd like to find the tables where the column 'x' has a specific value. Any thoughts on how to do that?

I'm thinking that I put the output of the part I know how to do into a table variable or a cte and then do something involving dynamic SQL, but I hate fiddling around with dynamic SQL, so I'm hoping there's another way to do it!

-
Richard Ray
DBA, Developer, Data Analyst
Jackson Hole Mountain Resort
 
I don't know of any other way to do this without dynamic SQL. Take a look here.


I wrote this part of the blog. It doesn't take in to account limiting the column names like you have, but it probably wouldn't be too difficult to add that either.


-George
Microsoft SQL Server MVP
My Blogs
SQLCop
twitter
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top