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 GrpListTestUser1 MyGroupTestUser2 MyGroupTestUser3 MyGroupTestUser4 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 grplistTestUser1 TestUser2 MyGroupTestUser1 TestUser3 MyGroupTestUser1 TestUser4 MyGroupTestUser2 TestUser1 MyGroupTestUser2 TestUser3 MyGroupTestUser2 TestUser4 MyGroupTestUser3 TestUser1 MyGroupTestUser3 TestUser2 MyGroupTestUser3 TestUser4 MyGroupTestUser4 TestUser1 MyGroupTestUser4 TestUser2 MyGroupTestUser4 TestUser3 MyGroup