Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to create a database alias or synonym? What I am hoping to be able to do is have NewDatabaseName aliased as OldDatabaseName to prevent having to rewrite a ton of code.

Backstory: I was approached by a client with a ridiculous self-induced problem. They have a third-party application that has a SQL server back-end. The users have been writing custom reports against this database using Visual Basic, with all database connection information hard-coded in their programs.

Recently the third party software renamed their database. Now all the report EXE's are failing.

Oh, they dont' have a lot of the source code either.

I held back my laughter and said I would see what I could do.

share|improve this question
up vote 11 down vote accepted

No this isn't possible (Related Connect Item)

You could create a new database of the original name and fill that with synonyms pointing to all the objects in the renamed database though.

share|improve this answer
That is a very interesting workaround. It just might get them through the little mess they are in. – datagod Dec 14 '11 at 18:26
@datagod - Hopefully it works. Shouldn't be too difficult to script out the CREATE SYNONYM statements from a query against sys.objects to test. – Martin Smith Dec 14 '11 at 18:28
For anyone that finds the synonym filled database an acceptable work-around, this newer SO question has code & links to code that will simplify scripting out the synonym creation.… – Arkaine55 May 13 at 14:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.