我正在尝试使用变量表来引导镜像报告sproc,以便我可以推出与此IS号相关的单一报告:
CREATE PROCEDURE [dbo].[report
(@Date DATETIME='11/11/2011')
AS
BEGIN
SELECT *
INTO #Temp
FROM dbo.vwview
WHERE
Date = @Date
DECLARE @tblnewReport TABLE(IS varchar(8))
SELECT subreportIS
INTO @tblnewReport
FROM #Temp
基本上,我的@tblnewReport
就是问题所在。任何想法将不胜感激!
答案 0 :(得分:3)
试试这个:
CREATE PROCEDURE [dbo].[report
(
@Date DATETIME='11/11/2011'
)
AS
BEGIN
SELECT *
INTO #Temp
FROM dbo.vwview
WHERE
Date = @Date
DECLARE @tblnewReport TABLE
(IS varchar(8))
INSERT
INTO @tblnewReport
SELECT SubreportIS FROM #Temp