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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 quering a comma delimited field

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-11-02 : 09:03:39
JEff writes "I have a project table that has a comma deliminated field of assigned users. A project can have 0, 1, or many assigned users. The field contains UserID's that are in a user table.

Example
PRoject_Name, Assigned_user
proj1           3
proj2           3,4


User table
3      john
4      mike



I am creating a reporting tool and want to search by assigned users. so If I want to find all projects user 4 is assigned to. I have to search for '4' '4,' ',4' etc. I can't use like because like '%4,' will pull up 14, I am having problems getting my search to work. Basically I need a way to pull out the user ID from a comma deliminated string whether it is in the begining 4,3 or middle 3,4,8 or end 3,8,4. UserID's can be in the hundreds ex 104, 213. Please let me know if you have any suggestions.

Thanks"
   

- Advertisement -