我有一点练习,需要从视图中访问数据并在报表中打印出来。我创建了一个#temporary表来存储数据,并使用while循环将其检索并显示在报告中。#临时表Microsoft SQL似乎迷失
问题是临时表似乎“失踪”。
--Creating my report
USE PetShopDataBase
CREATE PROCEDURE spPetShopReport
@customerID INT
SELECT *
INTO #temporary
FROM vwPetshop
WHERE customerID = @customerID
GO
ALTER TABLE #temporary
ADD Printed SMALLINT
GO
然后从这个点,当我运行的代码是
Msg 4902, Level 16, State 1, Line 2
Cannot find the object "#temporary" because it does not exist or you do not have
permissions.
为什么该对象被视为无效
UPDATE #temporary
SET Printed = 0
GO
错误消息我得到什么?
类regdards
其中/你是如何创建临时表?你能显示TSQL代码吗? – rt2800 2012-04-25 09:22:38