无法在 SQL Azure 中的数据库之间进行查询 [英] Can't query between databases in SQL Azure

查看:26
本文介绍了无法在 SQL Azure 中的数据库之间进行查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 SQL Azure 数据库服务器,我需要在数据库之间进行查询,但不知道如何实现.

I have a SQL Azure Database Server and I need to query between the Databases but can't figure out how to accomplish this.

这是我的数据库结构:

  • Server.X
    • 数据库.A
    • 数据库.B
    • Database.C

    Database.A 中,我有一个需要从Database.B 中检索数据的存储过程.通常,我会像 SELECT * FROM [Database.B].[dbo].[MyTable] 一样引用数据库,但这在 SQL Azure 中似乎是不允许的.

    In Database.A I have a Stored Procedure that needs to retrieve data from Database.B. Normally, I would reference the database like SELECT * FROM [Database.B].[dbo].[MyTable] but this does not appear to be allowed in SQL Azure.

    消息 40515,级别 15,状态 1,第 16 行此版本的 SQL Server 不支持在Database.B.dbo.MyTable"中引用数据库和/或服务器名称.

    有没有办法在数据库端做到这一点?

    Is there a way to do this on the database end?

    在最终版本中数据库 A &C 都需要来自数据库 B 的数据.

    In the final version Databases A & C will both need data from Database B.

    推荐答案

    更新:

    根据 Illuminati 的评论和回答,自从最初接受此答案以来情况发生了变化,现在支持根据 https://azure.microsoft.com/en-us/blog/querying-remote-databases-in-azure-sql-db/

    As per Illuminati's comment and answer, the situation has changed since this answer was originally accepted and there is now support for cross database queries as per https://azure.microsoft.com/en-us/blog/querying-remote-databases-in-azure-sql-db/

    原始答案 (2013):SQL Azure 不支持跨数据库查询.这意味着您首先需要组合数据库以防止需要,或者独立查询两个数据库并基本上连接应用程序中的数据.

    Original Answer (2013): Cross database queries aren't supported in SQL Azure. Which means you need to either combine the databases to prevent the need in the first place, or query both databases independently and basically join the data in your application.

    这篇关于无法在 SQL Azure 中的数据库之间进行查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆