hello, @reason is a list of checkboxes from a coldfusion form (example: '1,2,5' these values go from 1 to 16)
sometimes, none of the checkboxes is checked. in this case i set reason to "".
what i am trying to do with this stored procedure is to insert as many rows as i have elements in my list (3 rows for this example)
my problem is that a zero ( 0 ) is inserted in my table when none of the checkboxes is checked.i just don't see from where this zero comes from.
thanks for any adcice.
set @CommaLocation= charindex(',',@reason)
IF @Reason <> ''
BEGIN
WHILE @CommaLocation > 0
BEGIN
set @NewInsert= left(@reason,@CommaLocation - 1)
Insert into table1 (t_ID,ReasonID)
values (@D1,@NewInsert)
set @reason = substring(@reason,@CommaLocation+ 1,50)
set @CommaLocation= charindex(',',@reason)
END
END
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.