• BEGIN TRAN

    CREATE TABLE yourTable (yourTableID INT IDENTITY, column1 VARCHAR(500), column2 VARCHAR(500))

    INSERT INTO yourTable (column1)

    SELECT '2 * 2+1 * 7'

    UNION ALL SELECT '1 * 1+2 * 4'

    UNION ALL SELECT '1 * 1+2 * 4+1 * 4'

    DECLARE @SQL AS VARCHAR(MAX)

    SELECT @SQL = COALESCE(@SQL + ';' + CHAR(10),'') +

    'UPDATE yourTable SET column2= ' + column1 + ' WHERE yourTableID = '+CAST(yourTableID AS VARCHAR(3))

    FROM yourTable

    PRINT @SQL

    EXEC(@SQL)

    --Check results

    SELECT * FROM yourTable

    ROLLBACK


    Forever trying to learn
    My blog - http://www.cadavre.co.uk/
    For better, quicker answers on T-SQL questions, click on the following...http://www.sqlservercentral.com/articles/Best+Practices/61537/
    For better, quicker answers on SQL Server performance related questions, click on the following...http://www.sqlservercentral.com/articles/SQLServerCentral/66909/