ORDER BY
. के लिए आपके पास एक अद्वितीय कॉलम होना चाहिए नियतात्मक परिणाम प्राप्त करने के लिए लेकिन इन पंक्तियों के साथ कुछ काम करना चाहिए।
;WITH T
AS (SELECT [FirstName],
( ROW_NUMBER() OVER (ORDER BY (SELECT 0)) - 1 ) / 4 AS Row,
( ROW_NUMBER() OVER (ORDER BY (SELECT 0)) - 1 ) % 4 AS Col
FROM [User])
SELECT [0] AS Column1,
[1] AS Column2,
[2] AS Column3,
[3] AS Column4
FROM T PIVOT (MAX(name) FOR Col IN ([0], [1], [2], [3])) P
ORDER BY Row