EF can't infer return schema from Stored Procedure selecting from a #temp table

后端 未结 4 1850
迷失自我
迷失自我 2020-11-27 03:02

Suppose the following:

CREATE PROCEDURE [MySPROC]
AS 
BEGIN

CREATE TABLE #tempSubset(
    [MyPrimaryKey] [bigint]  NOT NULL,
    [OtherColumn]  [int]     NO         


        
4条回答
  •  执念已碎
    2020-11-27 03:35

    Solution 1 Use a table variable instead of a temporary table.

    Solution 2 Use the Set FMTONLY off; SQL command in the procedure and you will get the column information to create a new complex type.

    Solution 3 This is not a good way, but it's a very easy way. Just add a select statement with dummy data and it will not execute because 1=0.

    you can check details on this link

提交回复
热议问题