0

I have below stored procedure :-

CREATE PROCEDURE [dbo].[DELETE_DATA_BY_TIMESTAMP] 
    @NUMBER_OF_DAYS_BEFORE int  
    AS
    BEGIN

    IF OBJECT_ID('dbo.TableFileID', 'U') IS NOT NULL
    DROP TABLE TableFileID; 

        select FileID into TableFileID from
        [dbo].[OUTPUT_JSON_LOG]
        where OutJsonStatus in ('Success' , 'Failed')
        and convert(date,CreatedOn)<convert(date,getdate()-@NUMBER_OF_DAYS_BEFORE) 

DELETE FROM OUTPUT_JSON_LOG

 .... Some DML Queries .....


select * from TableFileID

END

I want to get all the list of FileIds from select query in procedure :-

select * from TableFileID

I updated Entity framework edmx file.

in designer I can see function as :-

Public ObjectResult<Nullable<global::system.Int32>> DELETE_DATA_BY_TIMESTAMP(...)
{
  ....
  ....
  return base.ExecuteFunction<Nullable<global::system.Int32>>("DELETE_DATA_BY_TIMESTAMP",..);

}

When I am calling this function :-

var FileIds=context.DELETE_DATA_BY_TIMESTAMP(...);
return FileIds.ToList();

It always shows count 0 for list.

But internally it processes all fileIds.

How can I get this list of fileIds with above procedure.

C Sharper
  • 8,284
  • 26
  • 88
  • 151
  • Are you sure that you've Imported the stored procedure as a **Function**. Your question is very similar to this but not sure exact duplicate: [Getting data from stored procedure with Entity Framework](http://stackoverflow.com/questions/32140774/getting-data-from-stored-procedure-with-entity-framework) – Salah Akbari Jan 23 '17 at 10:33
  • @S.Akbari I have refered that question , but in that functionthere is no use of Dynamic table.. here TableFileID is Dynamic table I want to deal with – C Sharper Jan 23 '17 at 10:35
  • @S.Akbari Yes I do have imported it..In fact it has automatically got imported – C Sharper Jan 23 '17 at 10:36

0 Answers0