• phamm (10/15/2012)


    Thanks. I forgot to mention that these columns are string not integer.

    Is there a reason they are not integer? You could try something like this...

    DECLARE @col1 VARCHAR(20), @col2 VARCHAR(20)

    SELECT @col1 = '10000000', @col2 = '9870'

    SELECT CAST(CAST(@col1 AS INT) + CAST(@col2 AS INT) AS VARCHAR(20))

    A couple of caveats though. Since they are strings (varchar?, char?) you may have some instances of leading zeros which will be lost, so you will have to deal with finding them and adding them back. Also, it will fail if there are any non-numeric data in your values.

    Greg
    _________________________________________________________________________________________________
    The glass is at one half capacity: nothing more, nothing less.