I am using sql server 5 and reporting services
I am trying to add one space into a string that comes from a filter in report services...
My filter is the following; the user can select multiple days of the week, say MON and Fri...the filter displays the
fields as MON,FRI...
the field in the table that I am trying to select the data from has the days as MON, FRI...one space between the xomma and the next day...
what i want to do is insert a space for every occurance in the string so that i can retrieve the data correctly...
my code is as follows..;;
if (charindex('-2',@days) = 0 ) and (charindex('-3',@days) = 0)
begin
declare @index int
declare @totallength as int
declare @txt varchar(max)
select replace(@days,',',', ')
set @index = charindex(',',@days)
set @totallength = len(@days)
set @txt = substring(@days,1, @totallength)
-- Select Chosen Day(s)
-- set @wheredays = 'And day in ('''+substring(@txt,1,len(@txt)+1)+''')'
-- set @wheredays = 'AND star.ConcatenatePreferences(pa.ParticipantApplicationID, ''DAYS'') in ('''+substring(@txt,1,len(@txt)+1)+''')'
set @wheredays = 'AND day in ('''+substring(@txt,1,len(@txt)+1)+''')'
i read about using the replace() to replace all occurances of one character in a string..however, when i run the above code, it does not insert a space betweenj the comma and FRI for example...
can anyone tell me what i'm doing wrong here...or is there a better way to perform the insert...
I am trying to add one space into a string that comes from a filter in report services...
My filter is the following; the user can select multiple days of the week, say MON and Fri...the filter displays the
fields as MON,FRI...
the field in the table that I am trying to select the data from has the days as MON, FRI...one space between the xomma and the next day...
what i want to do is insert a space for every occurance in the string so that i can retrieve the data correctly...
my code is as follows..;;
if (charindex('-2',@days) = 0 ) and (charindex('-3',@days) = 0)
begin
declare @index int
declare @totallength as int
declare @txt varchar(max)
select replace(@days,',',', ')
set @index = charindex(',',@days)
set @totallength = len(@days)
set @txt = substring(@days,1, @totallength)
-- Select Chosen Day(s)
-- set @wheredays = 'And day in ('''+substring(@txt,1,len(@txt)+1)+''')'
-- set @wheredays = 'AND star.ConcatenatePreferences(pa.ParticipantApplicationID, ''DAYS'') in ('''+substring(@txt,1,len(@txt)+1)+''')'
set @wheredays = 'AND day in ('''+substring(@txt,1,len(@txt)+1)+''')'
i read about using the replace() to replace all occurances of one character in a string..however, when i run the above code, it does not insert a space betweenj the comma and FRI for example...
can anyone tell me what i'm doing wrong here...or is there a better way to perform the insert...