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)
 Convert Column Variable to String?

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-05-14 : 10:48:58
Anthony writes "Hello,

I wanted to see if it was possible to convert a Column Variable (that is comma delimited) to a string in SQL? I need to perform a %LIKE% operation on it and won't allow me to do it on a column... here is the code:

1. SELECT GroupName, Count(Subscribers.GroupName) AS num_subscribers
2. FROM Groups LEFT OUTER JOIN Subscribers
3. ON Groups.GroupName LIKE %Subscribers.GroupName%
4. GROUP BY Groups.GroupName

On line 3. I am comparing the value of Groups.GroupName with Subscribers.GroupName, which is a comma delmited list. If I could convert Subscribers.GroupName to a string somehow, would that work, or should I take a different approach?

Thanks a bunch!!"

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2002-05-14 : 11:23:02
on charindex(groups.groupname, subscribers.groupname) <> 0

<O>
Go to Top of Page
   

- Advertisement -