Click here to Skip to main content
16,018,460 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need a query which can be used in (or as) a function and retrieves all permutations of n values. And I need all permutations of length k where k = 1..n.

Extended sample input and result so input has 3 values instead of 2 - however, number of input values may vary from 1 to n.

Example:

Input: table with values in one column in multiple rows

Value (nvarchar(500))
------
Ann
John
Mark

Output#1: table with values concatenated in one column

Ann
John
Mark
Ann,John
Ann,Mark
John,Mark
Ann,John,Mark
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900