Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
R4J_1
Starting Member
7 Posts |
Posted - 2005-10-26 : 06:08:37
|
| Hi,I was hoping someone would be able to help me, I trying to go through several databases, 111 to be exact, and get the data out of a particular table which is present in all the databases on the same server.I know how to get the names of the databases from the INFORMATION_SCHEMA, but how can use the name for it to cycle through all the databases and get data out of the one particular table. |
|
|
sachinsamuel
Constraint Violating Yak Guru
383 Posts |
Posted - 2005-10-26 : 06:15:27
|
| Use a cursor or table datatype. Iterate through them and get ur data using Exec, or sp_executeSQL.regardsSachin |
 |
|
|
R4J_1
Starting Member
7 Posts |
Posted - 2005-10-26 : 06:37:04
|
| Thanks, How could I iterate through them, sorry am a beginner here. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-10-26 : 06:40:14
|
| Why do you want to do this?MadhivananFailing to plan is Planning to fail |
 |
|
|
R4J_1
Starting Member
7 Posts |
Posted - 2005-10-26 : 06:45:01
|
| I have several client databases from which i need to retrieve some details stored in a table called users in each db. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-10-26 : 07:01:52
|
| Run this in Query Analyserselect 'Select * from '+catalog_name+'..users' from information_Schema.schemataCopy the results and paste them in QAThen run them one by oneMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|