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 |
|
SLM09
Starting Member
31 Posts |
Posted - 2009-10-02 : 13:10:31
|
| Is it possible to select the server with something like 'USE' from within the code so multiple queries accessing different servers can run one after another?ie- something along the lines of:USE ServerName1.DB1.table1 SELECT ...USE ServerName2.DB2.table2SELECT ...I have found info how to do this from other languages which require a string with login and pw in it (which may not be required with windows authentication)... Just haven't been able to find anything in SQL. Thanks |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-10-02 : 13:13:47
|
| nope this is not possible. you can change db however using use |
 |
|
|
SLM09
Starting Member
31 Posts |
Posted - 2009-10-02 : 13:17:57
|
| Thanks visakhI knew about changing the table and had high hopes for it to be able to handle servers as well. Oh well, maybe in a future release. :P |
 |
|
|
mivey4
Yak Posting Veteran
66 Posts |
Posted - 2009-10-02 : 13:24:28
|
| You may want to consider the possibility of using linked servers to perform multiple queries across Servers though, this is possible.You still won't be able to use the keyword USE but you will be able to do something like this to any Database Server from one system:SELECT column1, column2 FROM [ServerName].[DatabaseName].dbo.[TableName]Oracle OCAAdaptec ACSP |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-10-02 : 13:29:53
|
| or you could even use ssis to change server connection and execute queries dynamically inside a loop container |
 |
|
|
|
|
|