This question already has an answer here:
I have field id_list='1234,23,56,576,1231,567,122,87876,57553,1216'
and I want to use it to search IN
this field:
SELECT *
FROM table1
WHERE id IN (id_list)
id
isinteger
id_list
isvarchar/text
But in this way this doesn't work, so I need in some way to split id_list
into select query.
What solution should I use here? I'm using the T-SQL Sybase ASA 9 database (SQL Anywhere).
But in this way this doesn't work, so I need in some way to split id_list
into select query.
Way I see this, is to create own function with while loop through, and each element extract based on split by delimiter position search, then insert elements into temp table which function will return as result.
table1_id, other_id
combination. – Martin Smith Oct 12 at 13:14[sybase]
tag. I have no idea; my close vote may be inappropriate. Maybe some of the techniques presented in there will apply? – Jon Seigel Oct 12 at 15:11SELECT row_value as testRecord FROM sa_split_list('A,B,C');
but I have no idea if Sybase hasCROSS APPLY
or something to use this against a column. – Martin Smith Oct 12 at 15:19