Link to home
Start Free TrialLog in
Avatar of SQL Guru
SQL Guru

asked on

Entity Framework doesn't recognise datatype

I have two temp tables, storing the output  results from two different sp's.Finally I union two temp table and shows the final output.

But when i called it from Entity framework, it doesn't returns the table instead it's return int. What is happening here.

If i use the data contract , then its work. I have a solution but i like to know is there any other method to fix it apart introducing the faux data contract for the result set.What is the root cause behind this.I want to fix this issue from EF and not to provide the workareound solution.
Link helped me fixed the issue :
https://jacstech.wordpress.com/2013/09/27/getting-entity-framework-to-recognise-the-return-type-of-a-stored-procedure-that-returns-a-temp-table/
Avatar of Najam Uddin
Najam Uddin
Flag of United States of America image

Try putting
SET FMTONLY OFF

Open in new window

in you stored proc then retry adding in entity frameowork.

Per MSDN
Returns only metadata to the client. Can be used to test the format of the response without actually running the query.
Avatar of SQL Guru
SQL Guru

ASKER

My concerns, why does Entity Framework doesn't take the datatype by default?
ASKER CERTIFIED SOLUTION
Avatar of Najam Uddin
Najam Uddin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
import the procedure EF must execute it, executing  them may effect you database as they may be doing some changes.

What changes does it do? How does will it impact the database?
Whatever changes you have coded in your stored proc.