Populating SQL table - problem w/populating Identity column

  • Hi there,

    I am attempting to do a bulk insert task from One SQL table to another. I have added an Identity column to new table.

    It something similar to following:

    ParentTable:

    Col#1,Col#2,col#3,Col#4

    NewTable:

    Col#0, Col#1,Col#2,Col#3,Col#4

    Here Col#0 is Identity column.

    I can't figure out how I can acheive the Insert task populating col#0.

    Please Advise,

    Thanks

  • If the Id is not important then all you need to do is not connect a data flow to the ID column and it will populate itself.

    If it is important and needs to be preserved form your source data, then you will need to Enable Identity insert on your destination table.

  • Thanks for responding. I was able to do it.

    I used Import and Export wizard. As per my case, instead of selecting a whole table, I used a query for selecting source data.

    As per my previous posting, I kept everything as it is(Table structure/metadata). I didn't check enable identity insert.

    It automatically populated the Identity column.

    Earlier, I had this column as PK and may be this was causing some issue. AS .."Column cannot allow NULLS. Insert fails"

    However, this time, I added PK to the column after insertion was complete. It worked.

  • I am happy you solved this, Thanks for the Feedback..

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply