Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

database alias

Status
Not open for further replies.

sixteamparlay

IS-IT--Management
Aug 1, 2008
46
US
Is it possible to give a database an alias name?

we have a database called Database

after a software migration the database had to be copied to Database2

There is no way in the software package to change what db it points to once it is installed.

Is there a way I can create an alias so Database points to Database2?

Thank you
 
Can you simply rename it back to Database ?

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Yes that is easy in SQL 2005 management studio but the s/w doesnt allow us to change where it points to. Is there a way to alias?
 
This is an alias [DATABASE2]. If you see the actual names of the DB it could be something like:
MyDBThatIsHere.mdf :)
So rename it with SSMS.

Borislav Borissov
VFP9 SP2, SQL Server 2000/2005.
 
Is there a way I can create an alias so Database points to Database2?

No. Not that I am aware of.

There are a couple things you could do. If your application is looking for a database named [Database], then that database must exist. So, renaming the database is certainly an option.

If you can't rename the database, then perhaps you could create a new database named [Database] and then use synonyms to point to [Database2].

Ex:

Code:
Create Database [Database]
go
Use [Database]
go
Create Synonym [dbo].[YourTableNameHere] For [Database2].[dbo].[YourTableNameHere]

Unfortunately, you will need to create synonyms for EVERY object in your database (Tables, views, procedures, functions, etc...)

You'll also need to remember to create synonyms anytime you add an object. This will NOT be fun.

Synonym is new functionality introduced in SQL2005. (So you SQL2000 users should ignore this.)

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top