HowardMarks
MIS
Hi Guys
I am writing a SQL statement to extract all items from a database, where the items ID is contained within a delimited list, but i can't get it to work.
the string is something like {1},{2},{5},{7}
so the statement i need is something like
SELECT * FROM ITEMS WHERE '" & IDString & "' LIKE ITEM_ID
but this doesnt work. Even if it did work i would need to surround the item id by {'s to avoid any number being returned as true just because it appears within another number e.g. ID 131 would return true for ids 1 and 3 unless surrounded by brackets.
I can accomplish the same effect easily enough by selecting all items and filtering them via ASP but i would much prefer selecting just the matching items via the SQL.
Does anyone have any suggestions?
Thanks alot
Nick
Nick (Webmaster)
I am writing a SQL statement to extract all items from a database, where the items ID is contained within a delimited list, but i can't get it to work.
the string is something like {1},{2},{5},{7}
so the statement i need is something like
SELECT * FROM ITEMS WHERE '" & IDString & "' LIKE ITEM_ID
but this doesnt work. Even if it did work i would need to surround the item id by {'s to avoid any number being returned as true just because it appears within another number e.g. ID 131 would return true for ids 1 and 3 unless surrounded by brackets.
I can accomplish the same effect easily enough by selecting all items and filtering them via ASP but i would much prefer selecting just the matching items via the SQL.
Does anyone have any suggestions?
Thanks alot
Nick
Nick (Webmaster)