Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Need to Merge text in a cell Expand / Collapse
Author
Message
Posted Tuesday, December 24, 2013 12:15 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, May 8, 2014 10:30 PM
Points: 32, Visits: 113
HI ,

If i have a value as AAA,AAA,AAA,AAA,BBB,CCC
Then i want return it as AAA,BBB,CCC. Can Anyone please suggest whether this is possible.


Thanks in Advance
Post #1525693
Posted Wednesday, December 25, 2013 5:49 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Tuesday, August 5, 2014 5:37 AM
Points: 14, Visits: 19
Hi,

http://www.sommarskog.se/arrays-in-sql.html or https://www.simple-talk.com/sql/t-sql-programming/faking-arrays-in-transact-sql/ or http://www.sqlservercentral.com/articles/T-SQL/63003/
Post #1525885
Posted Saturday, December 28, 2013 5:27 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 4:15 PM
Points: 7,155, Visits: 13,215
You could split the string using the Delimited Split Function refernced in my signature and the "FOR XML PATH" approach together with a DISTINCT to build te final string.
If the length of each element is known and constant, the split function can be simplified.




Lutz
A pessimist is an optimist with experience.

How to get fast answers to your question
How to post performance related questions
Links for Tally Table , Cross Tabs and Dynamic Cross Tabs , Delimited Split Function
Post #1526288
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse