To string or not to string

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

USE master
DECLARE @ varchar(max)='T-SQL';

WITH C as
(
  SELECT DISTINCT substring(@,number+1,1)x
  FROM spt_values
  WHERE'P'=type and len(@)>number
),D as
(
  SELECT x y
  FROM c UNION ALL
  SELECT y+x
  FROM C JOIN D
  ON len(y)<len(@)
)SELECT top 1*FROM D
GROUP BY y
ORDER BY newid()

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results