Experts Exchange connects you with the people and services you need so you can get back to work.
Improve company productivity with a Business Account.Sign Up
set @SQL= @Sql + ' And D.DivisionName LIKE ''%'+@DivisionName+'%'''
Open in new window
set @SQL= @Sql + ' And D.DivisionName IN (select * from list_to_tbl(@DivisionName))'
CREATE FUNCTION list_to_tbl (@list nvarchar(MAX))
RETURNS @tbl TABLE (string varchar(250) NOT NULL) AS
DECLARE @pos int,
SELECT @pos = 0, @nextpos = 1
WHILE @nextpos > 0
SELECT @nextpos = charindex(',', @list, @pos + 1)
SELECT @valuelen = CASE WHEN @nextpos > 0
ELSE len(@list) + 1
END - @pos - 1
INSERT @tbl (string)
VALUES (substring(@list, @pos + 1, @valuelen))
SELECT @pos = @nextpos
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment
Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.
One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.