我有两个azure数据库,比如DB1和DB2。 DB1有几个表,我想在DB2中创建存储过程,以便与DB1中的表中的连接进行交叉查询。我已经看过跨数据库查询的示例,但主要只显示单个表。我的存储过程就像:
select
u.UserID as [UserID],
u.Username as [UserName],
u.LastLoginDate,
ISNULL(au.IsDeleted, 1) as [IsDeleted]
from DB1.[sec].[User] u
join DB1.[sec].[AppUser] au on (u.UserID = au.UserID)
join DB1.[sec].[Application] a on (au.ApplicationID = a.ApplicationID)
where (a.Name = 'name')