Find trailing comma and space in sql query
Posted on 2006-07-06
When using this line of code I get an intermittant CF error:
CF error was:
"In function ListGetAt(list, index [, delimiters]) the value of index, which is 1, is not a valid index for the list given as a the first argument (this list has 0 elements). Valid indexes are in the range 1 through the number of elements in the list."
Meta_keywords is a comma delimited list of keywords. I believe the error is thrown from a trailing comma at the end of the last meta_keyword, sometimes with an extra space, such as:
'one, two, three, '
How can I indentify a trailing comma in the sql 2000 database using an sql query? I'm not sure how to construct such an sql query and remove it.
To find the trailing comma:
WHERE (META_KEYWORDS LIKE '%,')
To find the trailing space:
WHERE (META_KEYWORDS LIKE '% ')
That seems to work but I'd like to be certain. It seems too simple.