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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 linked server

Author  Topic 

rauof_thameem
Starting Member

31 Posts

Posted - 2007-05-07 : 08:59:39
i am pulling data from one server to other server

in my query i am using [Server name].[database name].[schema name].[table name]

i having many produres where i will be using this one to specify the tables..,

if the server name changes i have to change these things all the queries

is there any way to maintain the server name as globly and acces the server name where ever i need..,

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-05-07 : 09:04:49
Possible options

If @server_name='something'
--Select using that server
.
.


Otherwise Dynamic sql is the way

But why do you want to pass Db name as parameter?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-05-07 : 09:10:09
If this is limited to few tables, I will suggest creating view around these tables and use view instead in your SPs.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page
   

- Advertisement -