1

How can I create a short alias name for a database?

I have a database that for use with an application has a very long name. I'm writing queries on the database in SQL Server and don't want to have to type out the long name.

I'd like to have

SELECT * FROM shrt_name.dbo.table_name 

instead of

SELECT * FROM garbase_long_db_name_rqrd_for_compatibility_reasons.dbo.tablename.

I'm aware of synonym for tables, but I need the whole db not each table.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Dylan Cross
  • 544
  • 2
  • 6
  • 14
  • Another person had the same issue: http://stackoverflow.com/questions/21722066/how-to-create-an-alias-of-database-in-sql-server – Stephan Apr 30 '15 at 16:30

1 Answers1

0

You can try creating a linked server referring to the database locally by specifying the database as default. Also, you can use USE statement in order to ignore fully qualifying your tables.

HGF
  • 389
  • 3
  • 15