小编Ste*_*ber的帖子

无法解析:“必须声明标量变量“@Parameter”`'

我需要在存储过程下面的枢轴中输入一个参数。但它指出,“必须声明标量变量“@pWeek”。”

我尝试以各种方式声明它,但我无法弄清楚这一点。这个编码的其他一切都很好,因为我以我想要的方式得到了我想要的数字。我只需要能够将其放入 SSRS 中并能够输入参数。谢谢。

GO
/****** Object:  StoredProcedure [dbo].[QB_ACCOUNT_SUMMARY]    Script Date: 6/19/2015 12:42:12 PM ******/
SET ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER PROCEDURE [dbo].[QB_ACCOUNT_SUMMARY]

@pWeek int

as
SET NOCOUNT ON

declare @AccountRef_Fullname AS  NVARCHAR(MAX)



select  @AccountRef_Fullname = COALESCE(@AccountRef_Fullname + ',', '') + '['+ AccountRef_Fullname + ']'

from 
(
select distinct Accountref_fullname 
from (select accountref_fullname from journalcreditlinedetail)JournalCreditLine
union
(select accountref_fullname from journaldebitlinedetail)
union
(select accountref_fullname from txnexpenselinedetail)
union
(select accountref_fullname from depositlinedetail)
union
(select discountaccountref_fullname from [appliedtotxndetail])
) pAccountRef_Full_Name …
Run Code Online (Sandbox Code Playgroud)

sql sql-server parameters scalar pivot

2
推荐指数
1
解决办法
2517
查看次数

标签 统计

parameters ×1

pivot ×1

scalar ×1

sql ×1

sql-server ×1