Hi Gurus,
I would like to know in what form the multiple value being passed into the script?
Problem : @Item is parameter allowed for multiple selection by user. Whenever I run the report, the report generated successfully with 1 value selected. When I select for multiple values, this error message prompted:
Query execution failed for dataset 'Dataset1'.
Incorrect syntax near ','.
The following is my code:
Many thanks in advance
I would like to know in what form the multiple value being passed into the script?
Problem : @Item is parameter allowed for multiple selection by user. Whenever I run the report, the report generated successfully with 1 value selected. When I select for multiple values, this error message prompted:
Query execution failed for dataset 'Dataset1'.
Incorrect syntax near ','.
The following is my code:
Code:
DECLARE @cslist VARCHAR(8000)
DECLARE @spot INT
DECLARE @str VARCHAR(8000)
DECLARE @sql VARCHAR(8000)
DECLARE @parm VARCHAR(8000)
set @cslist = replace((@Item),',')
WHILE @cslist <> ''
BEGIN
SET @spot = CHARINDEX(',', @cslist)
IF @spot>0
BEGIN
SET @str = convert(char, LEFT(@cslist , @spot-1))
SET @cslist = RIGHT(@cslist , LEN(@cslist)-@spot)
END
ELSE
BEGIN
SET @str = convert(char,@cslist)
SET @cslist = ''
END
set @parm=ltrim(@str)
****I perform some SQL selection based on @parm here****
END