Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
SquareEye
Starting Member
5 Posts |
Posted - 2008-06-03 : 12:10:55
|
| HelloI have a table with column Options where each field contains a comma delimited list of ID numbers.I want to select any records where a certain ID number appears in that list.So something like:SELECT * FROM Table t1WHERE MyID IN (SELECT Options FROM Table t2 WHERE t1.ID = t2.ID)But that gives me the error:Syntax error converting the varchar value '39,20' to a column of data type int.I feel I'm close though! Could anyone point me in the right direction?Many thanksSquare |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-06-03 : 12:21:33
|
| SELECT * FROM Table t1WHERE ',' + Option + ',' LIKE '%,' + CAST(MyID AS varchar(10)) + ',%' |
 |
|
|
SquareEye
Starting Member
5 Posts |
Posted - 2008-06-03 : 14:25:11
|
| Many thanks! |
 |
|
|
Page47
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2008-06-03 : 15:05:13
|
| Read Rule 1 (Information Rule) ....Jayto here knows when |
 |
|
|
|
|
|