SQL: how to get all the distinct characters in a column, across all rows

Posted by frankadelic on Stack Overflow See other posts from Stack Overflow or by frankadelic
Published on 2010-05-27T23:38:49Z Indexed on 2010/05/27 23:41 UTC
Read the original article Hit count: 147

Is there an elegant way in SQL Server to find all the distinct characters in a single varchar(50) column, across all rows?

Bonus points if it can be done without cursors :)

For example, say my data contains 3 rows:

productname
-----------
product1
widget2
nicknack3

The distinct inventory of characters would be "productwigenka123"

© Stack Overflow or respective owner

Related posts about sql

Related posts about sql-server