Take the 2-minute tour ×
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. It's 100% free, no registration required.

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
add comment

1 Answer

up vote 6 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
2  
@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
add comment

Your Answer

 
discard

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.