Reputation: 377
I have two azure SQL server each having single Database: Server1 with Database1 Server2 with Database2. Lets suppose Tables of two Database
Database1 has
Database2 has
I create external table Tbl_C of Database1 on Database2 and querying Tbl_C from Database2 works fine. Now I want to create external table Tbl_A of Database1 on Database2, how to create and query the cross database having same name? I am using SQL Server Express 2012. Please help me, thank you.
Upvotes: 2
Views: 1120
Reputation: 3744
Please use SCHEMA_NAME
and OBJECT_NAME
in the create statement.
Several important scenarios require the ability to name your external table differently than the original table on the remote database. Any scenario where a local table already exists with the same name as your remote table are examples of that. All of these scenarios require the ability to use an alias for the remote table name
See the example in the image below:
Reference: More Flexible Naming
Thanks.
Upvotes: 3