OPENROWSET在SQL Server 2012中不起作用

时间:2016-06-23 11:30:33

标签: sql sql-server sql-server-2012

我的存储过程发出带有动态列的reults set,有时它有10个,有时它有更多15还有我的存储过程有临时表,它返回到调用app。

select a.* 
into [tempdb].[dbo].[tempBase]
from openrowset('SQLNCLI', 'Server=.;Trusted_Connection=Yes;Integrated     Security=SSPI', 'SET NOCOUNT ON;SET FMTONLY OFF ; exec  LIQ_TradeBustTrader5895.dbo.price_report @loginID = ''ALL'', @tableName = ''order_msgs'', @firmname = ''ALL'', @AssetClass = ''All'',  @OutputBustRecords=0, @ManualOrder=0, @TimeFrom=''0:0'', @TimeTo=''23:59'', @ExcludeSimulatedTrades=0, @SingleTable =1 ') AS a;

现在我收到了这些错误:

  

Msg 11529,Level 16,State 1,Procedure sp_describe_first_result_set,Line 1   无法确定元数据,因为每个代码路径都会导致错误;查看其中一些错误。

     

Msg 4902,Level 16,State 1,Procedure sp_describe_first_result_set,Line 1   找不到对象" #Tethys_ReportGenerator_Tbl"因为它不存在或您没有权限。

1 个答案:

答案 0 :(得分:0)

几乎没有故障排除选项..

1.你的sp似乎有问题,所以试试运行你的sp,看看你能不能完成它...

Cannot find the object "#Tethys_ReportGenerator_Tbl" 

2.一旦您的sp成功完成,如果您仍然遇到问题,请尝试在SQL内部使用SQL运行,以便了解结果集的元数据。

exec [sys].sp_describe_first_result_set "your sp"