Entity Framework - FMTONLY

The scenario: a stored procedure in your database returns a query from a table variable. The stored procedure is added as a complex type to your edmx definition, however no return object is generated.

When the stored procedure is run, no meta data is returned for the table variable. On first generation, the best way to address this is the add the following within the stored procedure definition:

SET FMTONLY OFF

At the end of the definition, add the following:

SET FMTONLY ON

This forces the stored procedure to execute and return data as opposed to simply meta data. Entity can then inferr the returned object from the definition.

Be warned - this does not work when updating existing stored procedures.