Recently I got a requirement to migrate data from other sql server’s database to my local sql server’s database. Then I tried querying like this.
select * from ServerName.DataBaseName.dbo.TableName
When I ran the query “select * from FilterDB011.FilterWebDB.dbo.SiteUser” I got an error saying
“Could not find server ‘FilterDB011′ in sys.servers. Verify that the correct server name was specified. If necessary, execute the stored procedure sp_addlinkedserver to add the server to sys.servers.”
Then I ran the query ” execute sp_addlinkedserver FilterDB011″ as the error message suggested.
Then It worked fine.
Now I am able to access the tables and databases from that remote database server.
The syntax to add a remote sql server to sys.servers is:
execute sp_addlinkedserver sqlserverName
The syntax to access a table in remote sql server is:
SeverName.DatabaseName.dbo.TableName
Tuesday, April 28, 2009
Subscribe to:
Post Comments (Atom)






0 comments:
Post a Comment