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 |
aka_ankur
Starting Member
5 Posts |
Posted - 2011-11-18 : 11:41:38
|
Please help me in this....There are few databases DB1,DB2,DB3,DB4,DB5....each database has same tables T1,T2,T3.....Tn. (each table has same columns C1, C2, C3......Cn... but data in those tables are different)Requirement: *query:* select C1, C2, C3 from T1 inner join T2 on T1.C4 = T2.C4the query will be same for all databases.1. First step is to create drop down menu for Databases DB1, DB2, DB3, DB4, DB5Then select one or more databases after that the query should run for selected database or databeses. ---- What source should I select and how to create dataset for them. |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-11-18 : 11:44:43
|
what kind of requirement is this? why not use a union to put all data onto single table with a new derived column to denote the source db and then in your report add a filter based on dropdown to filter on this field?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
aka_ankur
Starting Member
5 Posts |
Posted - 2011-11-18 : 13:14:08
|
Yes you are right. But we can not change , update , delete anything to our databases and tables. So if you have any idea please let me know.Thanks |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-11-19 : 02:14:03
|
quote: Originally posted by aka_ankur Yes you are right. But we can not change , update , delete anything to our databases and tables. So if you have any idea please let me know.Thanks
this is a very poor way of implemeting requirement. if you want to do like this, you've pass db name through variable and then use a dynamic query based on it to execute and return the results. so at any one time, you'll show only one of db data?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|
|
|