Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Setup linked server with database name.

Author  Topic 

Ask SQLTeam Question

0 Posts

Posted - 2001-11-29 : 10:08:18
Kevin writes "I want to be able to write T-SQL stored procedures which refer to objects in another database, on another machine without having to specify both the server name and the database name. I want to do this because the machine which holds the SQL Server database changes from multiple development environments to testing environments to live. Also, usually the name of the database changes.

I have setup a linked server and this solves the changing server problem, but I would really like to specify the database in the linked server so that I dont have to refer to it explicitly in my T-SQL as follows:


Is it possible to setup the linked server so that I can refer to remote database objects like:


or something similar?

I am using SQL Server 2000 running on Windows 2000 and need to refer to both SQL Sever 2000 and SQL Server 7 databases.

Any help is much appreciated!"

Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2001-11-29 : 19:07:27
I guess you would be able to do it with Dynamic SQL

Go to Top of Page

Starting Member

1 Post

Posted - 2001-11-30 : 07:49:25

I guess you would be able to do it with Dynamic SQL


I dont really want to use dynamic SQL as I would still need to specify a database (which would have to be identified from somewhere), and ideally I would like to be able to specify/change the database using Entprise Manager or some suitable GUI.

Go to Top of Page

- Advertisement -