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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

get data from many tables 1

Status
Not open for further replies.

tirf

Programmer
Sep 22, 2008
59
US
we have more than 90 tables in our dataabase, most of the tables have colum called creaedUserID varchar(100);

I am trying to get a unique creaeduserID value from those table having this column;

Is there simple query to perform this

Thanks
 
Sure.

Run this:

Code:
Select	'Select createdUserID From [' + Table_Name + '] Union'
From	Information_Schema.Columns
Where	Column_Name = 'createdUserID'

Notice that the output will a a row for each table that has this column. Also notice the UNION keyword on the end of each row. Copy/Paste the output of the above script to a new query window, remove the UNION keyword from the last select statement, and then run it.


-George

"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