I want to split on spaces to basically get a list of words a user may enter in a search string.
For example user may search "Blue Chevrolet Corvette"
I then want to "full text search" format "Blue Chevrolet Corvette"
into
"Blue or Chevrolet or Corvette" "Blue near Chevrolet near Corvette"
so i found your function and hooked it up then unit tested with a " " and it errored. anyway I added these lines right above your line
--Custom code added by JP to split strings on blank strings
--Todo: need futher testing on spliting with characters + ' ' 4ex split on 'abc '
if len(@vcDelimiter) < 1
begin
SET @siDelSize= 1
end
else
begin
SET @siDelSize= LEN(@vcDelimiter)
end
--End custom code
--loop through source string and add elements to destination table array
WHILE LEN(@vcDelimitedString) > 0
Although it doesn't work for all scenarios is does work for the way I want to use it. BTW, thanks for the function good stuff. and If you know of a better way to accomplish what I'm trying to do by all means let me know...thanks.