Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql server SQL Server Reporting Services无法绑定多部分标识符_Sql Server_Stored Procedures_Reporting Services - Fatal编程技术网

Sql server SQL Server Reporting Services无法绑定多部分标识符

Sql server SQL Server Reporting Services无法绑定多部分标识符,sql-server,stored-procedures,reporting-services,Sql Server,Stored Procedures,Reporting Services,目前我有以下问题 我创建了一个Strored过程,该过程根据在SSRS中设计的报告上接收到的参数执行动态SQL 程序如下: alter PROCEDURE TablaDinamica @initdate datetime, @finaldate datetime, @pin varchar(30), @RID varchar(10), @PinState varchar(15), @charger varchar(50), @Document varchar(20) AS BEGIN De

目前我有以下问题

我创建了一个Strored过程,该过程根据在SSRS中设计的报告上接收到的参数执行动态SQL

程序如下:

alter PROCEDURE TablaDinamica @initdate datetime, 
@finaldate datetime, @pin varchar(30), @RID varchar(10), 
@PinState varchar(15), @charger varchar(50), @Document varchar(20)

AS
BEGIN
Declare @Where1 nvarchar(max) = ''
Declare @Where2 nvarchar(max) = ''
Declare @Where3 nvarchar(max) = ''
Declare @Select nvarchar(max)
Declare @FROM nvarchar(max)


if(@initdate IS NOT NULL and @finaldate IS NOT NULL)
BEGIN
SET @Where1 = 'a.generationdate between ''' + @initdate + ''' and 
'''+ @finaldate + ''''
if(@pin is not null or @pinstate is not null or @NombreRecaudador is not null)
SET @Where1 = @Where1+' and '
END
if(@pin is not null)
BEGIN
SET @Where2= 'pin='''+@pin+''''
if(@pinstate is not null or @charger is not null)
SET @Where2 = @Where2+' and '
END
if(@pinstate IS NOT NULL)
BEGIN
SET @Where3 = 'e.Nombre ='''+ @EstadoPin + ''''
if(@charger is not null)
SET @Where3 = @Where3+' and '
END
SET @Select= 'SELECT a.OpRCId,
a.Id,
f.OpClientId,
f.names,
f.lastnames,
f.Birthdate
SET @FROM = 'FROM 
a inner join b ON a.OpId = 
b.OpId
INNER JOIN c ON b.AdId = c.AdId
INNER JOIN d ON c.AdId = d.AdId
INNER JOIN e ON a.CId = e.CId
INNER JOIN f ON b.OpId = f.OpId
INNER JOIN g ON a.AdRId = g.AdRId
INNER JOIN s ON c.AdSId = s.AdSId
WHERE f.document = '''+@Document+''''

EXECUTE(@SELECT+@FROM+@Where1+@where2+@Where3)
END
当被排除时,它在SSM上运行良好,但在SSR上这是错误的

The multi-part identifier "a.OpRCId" could not be bound.
没有其他迹象表明有什么问题

我感谢你能给我的任何帮助

问候

注意:对于每个请求,这是

CREATE TABLE [dbo].[a](
    [OpId] [int] IDENTITY(1,1) NOT NULL,
    [OpCId] [int] NOT NULL,
    [CnEId] [int] NOT NULL,
    [OpLId] [int] NOT NULL,
    [AdId] [int] NOT NULL,
    [CnEId] [int] NOT NULL,
    [ANI] [numeric](18, 3) NOT NULL,
    [generationdate] [datetime] NOT NULL,
    [paymentdate] [datetime] NULL,
    [Pin] [varchar](30) NOT NULL,
    [Recovery] [numeric](18, 3) NOT NULL,
    [References] [varchar](50) NOT NULL,
    [Company] [numeric](18, 3) NOT NULL,
    [Total] [numeric](18, 3) NOT NULL,
    [Value] [numeric](18, 3) NOT NULL,
当被排除时,它在SSM上运行良好,但在SSR上这是错误的

The multi-part identifier "a.OpRCId" could not be bound.

使用探查器从SSR捕获执行(包括现有会话登录事件中的设置),并在SSMS中重现该问题。

对我来说,在f.Birthdate之后缺少一些引号和空格,并删除f.Birthdate和from之间的额外逗号。你能发布
a
架构吗,@HolmesIV谢谢,我已经在question@maSTAShuFu我已经添加了a@LightningSnake ... 查看错误,您能从模式中找到相同的列吗?但显然
a
schema
没有此列
OpRCId
这就是他们所说的“XY问题”。无论实际的语法错误是什么,真正的问题是当从SSR调用PROC时,OPs无法重新编程和诊断问题。