可能重复:
EF4 - 选定的存储过程不返回任何列
我有一个存储过程,它填充一个#temp 表,对其记录执行操作,然后选择记录。
问题是,当我尝试创建函数导入并单击 [获取列信息] 时,结果窗格显示消息“选定的存储过程或函数不返回任何列”。
现在,我知道它确实返回了列,因为如果我直接从数据库运行它,我会得到预期的结果集。
存储过程可以概括如下:
SELECT P.PersonID, P.Surname, P.NickName, P.DateofBirth
INTO #SeriesCompleted
FROM
Table1 T (NOLOCK)
INNER JOIN
Table2 P (NOLOCK) ON T.PID = P.PID
;
Select r.PID, SUM(rt.Distance) 'Distance'
INTO #Distance
FROM
#SeriesCompleted sc
inner join table3 rsr (NOLOCK) on rsr.SeriesId = sc.SeriesId
inner join table4 r (NOLOCK) on r.PID = sc.PID
inner join table5 rt (NOLOCK) on rt.RouteID = r.RouteID
GROUP BY r.PID;
UPDATE #SeriesCompleted
SET Distance = d.Distance
FROM #SeriesCompleted sc
INNER JOIN #Distance d on d.PID = sc.PPID;
--Here is where the result is returned.
SELECT distinct sc.PersonID, sc.NickName, sc.Surname, sc.DateofBirth, sc.NumberFinished, sc.Distance
FROM #SeriesCompleted SC