How do I get distinct characters of string column in mssql?
问题 Given: | name -+--------------------------- | Josef Knoller | Josef Somos | KFZ Wiesauer wanted result: JOSEFKNMLRZWIAU (case in the result does not matter - it was just easier holding the UPPER key while writing) Is there any way to do this in T-SQL ? sorry ... i've mixed column and row ... it's 1 column and n rows MLRZWIAU M comes from Somos L comes from Knoller R comes from Knoller ... clearer? 回答1: DECLARE @result VARCHAR(MAX) SET @result = '' DECLARE @t TABLE(name VARCHAR(400)) INSERT