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)
 Best way to handle dynamic server or table names

Author  Topic 

HelluvaEngineer
Starting Member

2 Posts

Posted - 2007-04-05 : 10:25:20
I have a system which uses multiple servers and log shipping. I really need to create a test environment for it so that I can test some stored proc changes. Since the server targets are often fully qualified (server.database.owner.table), setting up a test environment on a test server won't work. It will still try to hit the production databases.

So...I seem to remember some new feature in 2005 that allows you to alias a server. I have looked it up but can't seem to find it - perhaps I was imagining. What I wish I had is the equivalent of a #DEFINE in C.

The only thing I can think of is to make an app that will search and replace comment entries, like /* SERVERTARGET: db1Prod */

Any ideas? TIA

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-04-05 : 10:33:34
May be you can setup a linked server, refer it in your SPs/queries and configure it to point to the appropriate server still keeping your queries and procs intact.

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

HelluvaEngineer
Starting Member

2 Posts

Posted - 2007-04-09 : 12:05:03
A friend of mine suggested using a server alias and some host files. I'm currently researching that solution. Anyone familiar with this approach?
Go to Top of Page
   

- Advertisement -