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.


No this isn't possible (Related Feedback 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.

  • 1
    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. stackoverflow.com/questions/21722066/… – Arkaine55 May 13 '16 at 14:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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