Hello,
I have to take a list from AD and create a comma separated list for our cisco IM program. I really don't want to do this by hand so I thought I could import the list into SQL and manipulate it that way. Problem is I don't know how. The concept sounded easy until I started messing with it.
I have this test table:
create table #userList (UserId varchar(50),GrpList varchar(50))
insert into #userList values('TestUser1','MyGroup')
insert into #userList values('TestUser2','MyGroup')
insert into #userList values('TestUser3','MyGroup')
insert into #userList values('TestUser4','MyGroup')
select *
from #userList
Which gives you this:
UserId GrpList
TestUser1 MyGroup
TestUser2 MyGroup
TestUser3 MyGroup
TestUser4 MyGroup
I need to have a way to make it come out like this. I can't have the contactid show up in the userid column because that would mess with the IM client. Can anyone show me how to do this in a loop?
Thanks in advance.
contactid UserId grplist
TestUser1 TestUser2 MyGroup
TestUser1 TestUser3 MyGroup
TestUser1 TestUser4 MyGroup
TestUser2 TestUser1 MyGroup
TestUser2 TestUser3 MyGroup
TestUser2 TestUser4 MyGroup
TestUser3 TestUser1 MyGroup
TestUser3 TestUser2 MyGroup
TestUser3 TestUser4 MyGroup
TestUser4 TestUser1 MyGroup
TestUser4 TestUser2 MyGroup
TestUser4 TestUser3 MyGroup