Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Azure - Join 2 Azure SQL Server databases

Posted on 2014-01-20
3
Medium Priority
?
720 Views
Last Modified: 2014-11-12
I would like to join 2 Databases on my Azure cloud SQL Server, in an Azure cloud SQL Server stored procedure. From what I've read it's not so simple. Is there any solution?

Also, what's the best way to modify a cloud SQL Server stored procedure?
0
Comment
Question by:esak2000
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 11

Expert Comment

by:John_Vidmar
ID: 39795069
Configure linked servers, and use 3 or 4-part object references within the stored-procedure, here's the 4 parts:
      server.database.owner.object

Often, the owner is dbo, so people omit it, 3-part obj-ref example:
SELECT	*
FROM	Database1..table1	a
JOIN	Database2..table2	b	ON	a.key = b.key

Open in new window

0
 

Author Comment

by:esak2000
ID: 39796908
Where do the linked servers reside, in the Azure SQL Server or in a local SQL Server DB that is managed by SSMS?
0
 
LVL 11

Accepted Solution

by:
John_Vidmar earned 2000 total points
ID: 39799853
A stored-procedure (SP) must be installed in a database, any object references from that database do not need to be fully-qualified (assumes objects are in one schema).  If you want to access data from another database/source (of any supported technology) then you need to create a logical connection to that database/source (SQL Server calls this a linked-server).  If you try to use a 3-part or 4-part object-reference without a linked-server configured then you will receive the following error:
Msg 7202, Level 11, State 2, Line 11
Could not find server 'some database here' in sys.servers. Verify that the correct server name was specified. If necessary, execute the stored procedure sp_addlinkedserver to add the server to sys.servers.

Open in new window

0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As managed cloud service providers, we often get asked to intervene when cloud deployments go awry. Attracted by apparent ease-of-use, flexibility and low computing costs, companies quickly adopt leading public cloud platforms such as Amazon Web Ser…
Considering cloud tradeoffs and determining the right mix for your organization.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question