2

I've searched for this in quite a few areas, but haven't found a crystal clear answer to this.

I am working with multiple database servers and am consistently writing out [ServerName].[databasename].dbo.TableName. I know you can alias a table, but I can't find a definite answer on server and database.

Is it possible to create an alias that allows me to call the alias rather than calling the entire [ServerName].[databasename].dbo.TableName?

As an example: Server Name: SQL01 Database name: Client Desired Alias: Client

Sample table name on SQL01.Client: Contact

From SQL02, can I call Client.Contact like SELECT * FROM Client.Contact rather than having to write SELECT * FROM [SQL01].Client.dbo.Contact?

2
  • 1
    take a look here: stackoverflow.com/questions/6555646/… Commented Jul 16, 2012 at 15:14
  • Where do you want this Alias to be visible from? Commented Jul 16, 2012 at 15:17

1 Answer 1

1

If you haven't already come across it, the key word you're looking for is "synonym", and the documentation describes exactly the scenario you're interested in. So yes, it is possible.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.