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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-05-29 : 09:32:20
|
| Andre writes "I want to join a table based on its id being in a comma delimited list.LEFT JOIN [table] ON [table].[id] IN (1,2,3,4,5)....That works great... But what I really want to do, is store that list, in a column and do this...LEFT JOIN [table] ON [table].[id] IN ([MY DB COLUMN THAT HOLDS COMMA DELIMITED LISTS])But I get..."Cannot convert to integer datatype" In other words... now that its getting the ID list from a column, instead of me hardcoding it in... It errors. Its treating that my list as a string instead of a list. How do I store that list, in column... And still have my SQL see it as a list. Any ideas :P" |
|
|
setbasedisthetruepath
Used SQL Salesman
992 Posts |
Posted - 2002-05-29 : 09:56:11
|
You really don't want to store that list in a comma-delimited column - you want to store it as individual rows in a table. That way, your IN statement just becomes SELECTing from that table.quote: Andre writes "I want to join a table based on its id being in a comma delimited list.LEFT JOIN [table] ON [table].[id] IN (1,2,3,4,5)....That works great... But what I really want to do, is store that list, in a column and do this...LEFT JOIN [table] ON [table].[id] IN ([MY DB COLUMN THAT HOLDS COMMA DELIMITED LISTS])But I get..."Cannot convert to integer datatype" In other words... now that its getting the ID list from a column, instead of me hardcoding it in... It errors. Its treating that my list as a string instead of a list. How do I store that list, in column... And still have my SQL see it as a list. Any ideas :P"
setBasedIsTheTruepath<O> |
 |
|
|
|
|
|
|
|