Home Forums SQL Server 2005 T-SQL (SS2K5) Insert data into single table from multiple tables RE: Insert data into single table from multiple tables

  • Aiwa,

    I am confused by the source of your data to be inserted into resultTB. You say you have 2 different tables as source, but only list TB1.

    Also, is newColID a column in TB1?

    If TB1 is your only source table...

    INSERT into resultTB

    (PQID,col1,col2,newColID) --notice we do not explicity insert the identity column

    SELECT PQID,col1,col2,newColID

    FROM TB1 where PQID = ? and newColID = 1

    Todd Carrier
    MCITP - Database Administrator (SQL 2008)
    MCSE: Data Platform (SQL 2012)