0

次のsprocをEntity Frameworkに追加しようとしています。「モデルからの更新」を介してこれを追加した後、モデル ブラウザはモデルの「関数のインポート」および「ストアド プロシージャ/関数」にこの sproc を表示します。[関数のインポート] ダイアログの [編集] を使用すると、[列情報の取得] ができず、コレクションの戻り値の型を特定できません。

sproc からの出力は一時テーブルですが、返される列を定義します。このsprocは問題ですか?EF を設定する手順がありませんか?


 ALTER PROCEDURE [dbo].[addrApproxSP] 
-- Add the parameters for the stored procedure here
@frontage bigint = 0, 
@housedir varchar(1) = 0,
@streetnum bigint = 0, 
@streetdir varchar(1) = 0,
@distance bigint = 0
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Set Variables
DECLARE @lowfront bigint,
        @highfront bigint,
        @lowstreet bigint,
        @highstreet bigint,
        @currname varchar(25),
        @streetcur varchar(25),
        @whereclause varchar(40),
        @fixstreet varchar(25),
        @pos int,
        @piece varchar(500)

--Set variables to proper values in range
    Set @lowfront = @frontage - @distance
    set @highfront = @frontage + @distance
    set @lowstreet = @streetnum - @distance
    set @highstreet = @streetnum + @distance


-- Process for Street Names that are Numeric Values
-- Create Temp Table
CREATE TABLE #StreetNames
(streetname varchar(25))
-- SELECT StreetName and put in Temp table
INSERT #Streetnames(streetname)
select distinct streetname
from ADDR_STREETCOORD
where begincoord between @lowstreet and @highstreet
and STREETDIR = @streetdir
and lowhouse > @lowfront and HIGHHOUSE < @highfront
and HOUSEDIR = @housedir
union
select distinct streetname
from ADDR_STREETCOORD
where lowhouse > @lowstreet and HIGHHOUSE < @highstreet
and HOUSEDIR = @housedir
and begincoord between @lowfront and @highfront
and STREETDIR = @streetdir

-- Check each Streetname and those that are a coordinate (ex: "1000 S") change to "1000"
CREATE TABLE #FixStreets(streetname varchar(25))
DECLARE curStreet CURSOR FOR SELECT streetname FROM #StreetNames
    OPEN curStreet            
    FETCH NEXT FROM curStreet INTO @fixstreet  

    WHILE @@FETCH_STATUS = 0  
    BEGIN 
            --insert code here 
    INSERT #FixStreets(streetname)
        --Call Function to: parse the street name
        --if the first part isnumeric then insert that
        --if not numeric then keep as is
        select [dbo].fnParseCoordinate(@fixstreet)

        FETCH NEXT FROM curStreet INTO @fixstreet
    END 

CLOSE curStreet   
DEALLOCATE curStreet 

--select * from #FixStreets

--create a temp table to store the results of each street name in a single table
-- in order to return the results as a single table
--For Each street name search its frontage range values
--loop through each streetname to get the parcels matching those streets
CREATE TABLE #AllResults(Parcel varchar(14),Prop_locat varchar(50))
DECLARE curName CURSOR FOR SELECT streetname FROM #FixStreets
    OPEN curName            
    FETCH NEXT FROM curName INTO @streetcur  

    WHILE @@FETCH_STATUS = 0  
    BEGIN 
            --insert code here 
    INSERT #AllResults(Parcel, Prop_locat)

        select  parcel_id,prop_locat
        from ADDR_ParcelsWWW
        where StreetName = @streetcur
        and predir = @housedir
        and housefrom between @lowfront and @highfront
        union
        select parcel_id,LOCATOR_ADDRESS
        from ADDR_MASTERADDRESS
        where StreetName = @streetcur
        and predir = @housedir
        and housefrom between @lowfront and @highfront

        FETCH NEXT FROM curName INTO @streetcur
    END 

CLOSE curName   
DEALLOCATE curName 

--Select the results of all the tables
select Parcel, prop_locat from #AllResults

END

4

1 に答える 1