I am trying to pass a @year
parameter through SSRS to a SQL Server stored procedure that queries a Progress database. I am getting a syntax error at the @year
value when the stored procedure runs in ssrs.
Can anyone see something blindingly obvious that I have missed out please?
[stored procedure name]
@year nvarchar(max)
AS
BEGIN
SET NOCOUNT ON;
DECLARE @SQL nvarchar(max)
set @SQL = 'select *
from openquery
("server name",
''select
"PLACE-REF", "ACCOUNT-CODE", "TRANS-YEAR"
from "PLACE"."LOCATION"
where ((LTRIM(RTRIM(("LOCATION"."ACCOUNT-CODE" ))) IN (''''S/RTBQ'''',''''S/VATC'''' )))
and ("LOCATION"."TRANS-YEAR" = ''''' + @year + ''''') '') '
--print @sql
EXEC (@SQL)
END
Obviously this is a snippet of the code, but it gives a flavour of where I am at with reference to the parameter.
Thanks.