question

Christopher 1 avatar image
Christopher 1 asked

Make comma Splitted data

alter proc PICCMS_SP_GetExistingUsers                          
as                          
Select   U.UserID,(U.Firstname+' '+U.Lastname)as [Name],U.EmailID,U.Username,D.DomainCode ,UT.UserTypeName,U.Status  from Users U                     
inner join UserTypes UT on U.UserTypeID=UT.UserTypeID                    
inner join UserDomains UD on UD.UserID=U.UserID                    
inner join  Domains D on D.DomainID = UD.DomainID                    
where U.Status=1                    
order by U.Status Desc ,U.FirstName asc                    

This is my procedure

I want result like this

Username                Domains                    
================================                    
Christopher           AAA,BBB,CCC                    
KBR                   CCC,DDD                    

Like this i want result please give query

using UDF or While loop

user-defined-function
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Squirrel 1 avatar image
Squirrel 1 answered
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=81254            
or            
            
http://sqlblog.com/blogs/adam_machanic/archive/2006/07/12/rowset-string-concatenation-which-method-is-best.aspx            
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.