SQL Azure-跨数据库查询 [英] SQL Azure - cross-database queries

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

问题描述

我们有两个数据库,分别说"D1"和"D2".每个数据库中只有一个表,例如D1中的T1和D2中的T2. 现在我想在数据库D1中编写一个存储过程,该过程将访问数据库D2中的表,类似于下面的代码...

We have two databases let say 'D1' and 'D2'. There is one table in each database, say T1 in D1 and T2 in D2. Now I want to write a store procedure in database D1 which will access table in database D2 something like below code...

USE D1
GO
Create or replace sp_test
(
    --other detials 

    SELECT * FROM  D2.dbo.T2
)
GO

任何想法我该怎么做?

注意:之前我们曾经将两个数据库都放在同一服务器上.所以我没有遇到任何问题.但是现在,在迁移到Azure之后,我不知道我们如何做到这一点.另外,根据我的信息,我们在SQL-Azure中没有链接服务器功能.

Note: Earlier we used to have both the databases on to same server. So I didn't face any problem. But now after migrating to Azure I don't have any idea how we can do this. Also as per my information we don't have linked server feature available in SQL-Azure.

推荐答案

Azure SQL数据库(或SQL Azure)不支持跨数据库查询,因此除摆脱那些跨数据库查询外,没有其他解决方法. ..

Azure SQL Database (or SQL Azure) don't support cross-database queries, so there's no work around other than getting rid of those cross-database queries...

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

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