How can I join on a stored procedure?

后端 未结 9 2084
渐次进展
渐次进展 2020-12-25 10:48

I have a stored procedure that takes no parameters, and it returns two fields. The stored procedure sums up all transactions that are applied to a tenant, and it returns the

9条回答
  •  忘掉有多难
    2020-12-25 11:33

    Here's a terrible idea for you.

    Use an alias, create a new linked server from your server to its own alias.

    Now you can do:

    select a.SomeColumns, b.OtherColumns
    from LocalDb.dbo.LocalTable a
    inner join (select * from openquery([AliasToThisServer],'
    exec LocalDb.dbo.LocalStoredProcedure
    ') ) b
    on a.Id = b.Id
    

提交回复
热议问题