• here's an example i wrote that splits sys.tables into five columns;

    i hope it's obvious how you could apply the same logic to your data.

    WITH

    baseCTE AS

    (

    SELECT

    (ROW_NUMBER() OVER (ORDER BY Name)-1)/5+1 AS RW,

    (ROW_NUMBER() OVER (ORDER BY Name)-1)%5+1 AS CL,

    Name

    FROM sys.tables

    )

    SELECT MAX(CASE WHEN CL = 1 THEN Name ELSE '' END) AS Col1TableName,

    MAX(CASE WHEN CL = 2 THEN Name ELSE '' END) AS Col2TableName,

    MAX(CASE WHEN CL = 3 THEN Name ELSE '' END) AS Col3TableName,

    MAX(CASE WHEN CL = 4 THEN Name ELSE '' END) AS Col4TableName,

    MAX(CASE WHEN CL = 5 THEN Name ELSE '' END) AS Col5TableName

    FROM baseCTE

    GROUP BY RW

    ORDER BY RW

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!