Kiddo
Kiddo

Reputation: 5082

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.

I can get column information and create a complex type 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.

It says: 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.

Here is my 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

Upvotes: 1

Views: 2809

Answers (2)

Lodlaiden
Lodlaiden

Reputation: 391

It's a little late, but you have to turn NOCOUNT back on before the "real" select, so that it can use that to create your projection list.

Upvotes: 0

Kiddo
Kiddo

Reputation: 5082

duplicated the sp and renamed it and did the whole process again

Upvotes: 1

Related Questions