• Hello,

    I tried this code in SQL 2000 but get this error: "Incorrect syntax near the keyword 'FOR'." Why is that?

    IF OBJECT_ID('TEMPDB..#IF_BestPriceMfg2') IS NOT NULL

    DROP TABLE #IF_BestPriceMfg2

    CREATE TABLE #IF_BestPriceMfg2

    (

    GlobalCustomer INT,

    Productline_ID VARCHAR(6)

    )

    INSERT INTO #IF_BestPriceMfg2

    SELECT GlobalCustomer

    ,Productline_ID

    FROM #IF_BestPriceMfg

    GROUP BY GlobalCustomer

    ,Productline_ID

    SELECT * FROM #IF_BestPriceMfg2

    SELECT p1.GlobalCustomer,

    ( SELECT Productline_ID + ','

    FROM #IF_BestPriceMfg2 p2

    WHERE p2.GlobalCustomer = p1.GlobalCustomer

    ORDER BY Productline_ID

    FOR XML PATH('')

    ) AS Concat_Values

    FROM #IF_BestPriceMfg2 p1

    GROUP BY p1.GlobalCustomer ;