简体   繁体   English

实体框架4函数导入存储的proc复杂类型不返回任何列

[英]entity framework 4 function imports stored proc complex type return no column

I have imported a SP to Entity Entity Data Model and added it to the function imports. 我已将SP导入到实体实体数据模型,并将其添加到功能导入中。

I can get column information and create a complex type GetErrorCheckJobs_Result . 我可以获取列信息并创建复杂类型GetErrorCheckJobs_Result

However, after i added a parameter onto the sp and try to update(refresh,delete and add back) the function import, it failed to retrieve column information. 但是,在我将参数添加到sp并尝试更新(刷新,删除并重新添加)函数导入后,它无法检索列信息。

It says: the selected stored procedure returns no columns 它说: the selected stored procedure returns no columns

I have searched various solutions online and have 我已经在线搜索了各种解决方案,

SET NOCOUNT OFF

SET FMTONLY OFF

at the beginning of my SP but still no luck. 在我开始SP时,但仍然没有运气。

Here is my sp: 这是我的sp:

ALTER Procedure [dbo].[s_GetErrorCheckJobs]
                        @ErrorChecked bit

as
begin
 SET NOCOUNT OFF
 SET FMTONLY OFF


IF OBJECT_ID('tempdb..#TempColumns') IS NOT NULL DROP TABLE #TempColumns


create table #TempColumns 
(
        AssetID int
        ,JobReference varchar(30)
        ,DetailCode varchar(4)

        ,Lamp varchar(255)
        ,pLamp varchar(255)

        ,LuminaireType varchar(255)
        ,pLuminaireType varchar(255)

        ,ColumnStyle varchar(255)
        ,pColumnStyle varchar(255)

        ,ColumnHeight varchar(255)
        ,pColumnHeight varchar(255)

        ,ColumnOutreach varchar(255)
        ,pColumnOutreach varchar(255)
)


//Insert into #TempColumns 
//update #TempColumns 

select 
v.JobId
,v.JobReference
,v.ErrorChecked
,v.WASPAssetId
,v.StreetlightId
,v.DateReceived
,v.DateDueActual
,v.DateCompleted
,v.ActivityCodeIdActual
,v.CrewId
,v.JobCause
,v.Suburb
,v.Address
,v.Problem
,v.SpecialInstructions
,v.Notes

,t.Lamp
        ,t.pLamp

        ,t.LuminaireType 
        ,t.pLuminaireType

        ,t.ColumnStyle 
        ,t.pColumnStyle

        ,t.ColumnHeight 
        ,t.pColumnHeight

        ,t.ColumnOutreach 
        ,t.pColumnOutreach

         from v_errorcheck_jobs v
join #TempColumns t on t.jobreference = v.jobreference and t.assetid = v.waspassetid
where v.ErrorChecked = @ErrorChecked

end

any help appreciate, thanks 任何帮助表示感谢,谢谢

复制sp并将其重命名,然后再次执行整个过程

有点晚了,但是您必须在“真实”选择之前重新打开NOCOUNT ,以便它可以使用它来创建投影列表。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM