存储过程调用的问题
在查询分析器中执行存储过程能正确返回数据,但是在前台调用的时候无法返回数据--------------------
存储过程部分代码如下:
CREATE Procedure BuildTimeRecords(......)
AS
CREATE TABLE [#TimeRecords] (
[emp_id] [nvarchar] (12) COLLATE Chinese_PRC_CI_AS NULL ,
[Clock_id] [nvarchar] (2) COLLATE Chinese_PRC_CI_AS NULL ,
[CurrentDay] [datetime] NULL,
[Card_id] [nvarchar] (16) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[flag] [tinyint] NULL ,
[mark] [varchar] (2) COLLATE Chinese_PRC_CI_AS NULL ,
[sign_time] [datetime] NULL ,
[pass_kind] [varchar] (1) COLLATE Chinese_PRC_CI_AS NOT NULL
)
.......................
IF @ReturnType=0
.......
ELSE
BEGIN
SELECT #TimeRecords.emp_id,employee.emp_fname,#TimeRecords.CurrentDay,a.cu,
MAX(CASE mark WHEN 0 THEN CONVERT (VARCHAR(8),sign_time,108) END) AS [0],
MAX(CASE mark WHEN 1 THEN CONVERT (VARCHAR(8),sign_time,108) END) AS [1],
MAX(CASE mark WHEN 2 THEN CONVERT (VARCHAR(8),sign_time,108) END) AS [2],
MAX(CASE mark WHEN 3 THEN CONVERT (VARCHAR(8),sign_time,108) END) AS [3],
MAX(CASE mark WHEN 4 THEN CONVERT (VARCHAR(8),sign_time,108) END) AS [4],
MAX(CASE mark WHEN 5 THEN CONVERT (VARCHAR(8),sign_time,108) END) AS [5],
MAX(CASE mark WHEN 6 THEN CONVERT (VARCHAR(8),sign_time,108) END) AS [6],
MAX(CASE mark WHEN 7 THEN CONVERT (VARCHAR(8),sign_time,108) END) AS [7],
MAX(CASE mark WHEN 8 THEN CONVERT (VARCHAR(8),sign_time,108) END) AS [8],
MAX(CASE mark WHEN 9 THEN CONVERT (VARCHAR(8),sign_time,108) END) AS [9],
pass_kind
FROM #TimeRecords
INNER JOIN (SELECT emp_id,CurrentDay,Count(*) cu FROM #TimeRecords
GROUP BY emp_id,CurrentDay ) a
ON a.emp_id=#TimeRecords.emp_id AND #TimeRecords.CurrentDay=a.CurrentDay
INNER JOIN employee ON #TimeRecords.emp_id=employee.emp_id
GROUP BY #TimeRecords.emp_id,#TimeRecords.CurrentDay,#TimeRecords.pass_kind,a.cu,employee.emp_fname
ORDER BY #TimeRecords.emp_id,#TimeRecords.CurrentDay
END
Drop Table #TimeRecords
GO
--------------------------
按照以前遇到的情况 是因为没有删除临时表造成的 现在加了删除临时表 但问题仍照旧