• You can also do this (I'm just showing another way to pivot):

    ;WITH sourceData ([RowID],[Region], [Factor])

    AS

    (

    SELECT '1','Capitol',' Text1' UNION ALL

    SELECT '2','Capitol',' Text2' UNION ALL

    SELECT '3','Capitol',' Text3' UNION ALL

    SELECT '1','Central',' Text4' UNION ALL

    SELECT '2','Central',' Text5' UNION ALL

    SELECT '3','Central',' Text6' UNION ALL

    SELECT '1','North' ,'Text7' UNION ALL

    SELECT '2','North' ,'Text8' UNION ALL

    SELECT '3','North' ,'Text9'

    )

    SELECTRowID,

    MAX(CASE WHEN Region = 'Capitol' THEN Factor END) AS Capitol,

    MAX(CASE WHEN Region = 'Central' THEN Factor END) AS Central,

    MAX(CASE WHEN Region = 'North' THEN Factor END) AS North

    FROM sourceData

    GROUP BY RowID

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001