DECLARE @Value AS VARCHAR(20) = 'ABCC' DECLARE @NoOfChars AS INT = LEN(@Value) DECLARE @Permutations TABLE (Value VARCHAR(20)) ; WITH NumTally AS ( --Prepare the Tally Table to separate each character of the Value. SELECT 1 Num UNION ALL SELECT Num + 1 FROM NumTally WHERE Num < @NoOfChars ), Chars AS ( --Separate the Characters SELECT Num, SUBSTRING(@Value, Num, 1) Chr FROM NumTally ) SELECT * FROM Chars