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 |
|
rpc86
Posting Yak Master
200 Posts |
Posted - 2008-08-21 : 20:17:46
|
| Hi guys,How will I connect to other Server Name and Database name ? Say I'm in SQL Query and my current server is (Local), and my database is myDB. How will I connect to (Server_01) and to open a Database from it?Thank you |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
rpc86
Posting Yak Master
200 Posts |
Posted - 2008-08-21 : 20:22:32
|
| I already have 2 servers. How to use a linked server?thank you |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2008-08-21 : 20:27:09
|
| Once you've setup the linked server, you can then use the four-part naming convention to get to the remote server:LinkedServerName.DatabaseName.ObjectOwner.ObjectNameTara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Subscribe to my blog |
 |
|
|
rpc86
Posting Yak Master
200 Posts |
Posted - 2008-08-21 : 20:30:35
|
| Ok. I tried this one. Under my local development machine, there are 2 databases DB1 and DB2. How will I switch to other database on the same server name ? I changed my questions because its hard for me to cope that. Thanks. |
 |
|
|
ratheeshknair
Posting Yak Master
129 Posts |
Posted - 2008-08-22 : 04:39:49
|
| Usethe command USE DB_name to switch between databases.If u are in DB1 and want to access table from DB2 then select * from DB2.schema_name.table_nameRKNAIR |
 |
|
|
|
|
|