error on inserting to a row_id column

  • Hi experts,

       I am using DTS to load summary data from a table to another table.

    However, the destination table contains a row_id column (RECID) which is not null, not an identity and it's numeric.  I received error on the Transform Data Task:

    Cannot insert the value NULL into column 'RECID', column does not allow nulls. Insert fails.

    How should I do?  Thanking you in advance.

  • your problem is, from source table your RECID(or row_id) column is defined as NULL but your destination table RECID is  not NULL.

    The means that some of the records in source table have NULL value in this columns.

    If you run this query in your souce table, you will know I mean.

    select top 1 * from table.RECID is null

     

     

  • I am sorry that I didn't explain it clearly.

    The source table doesn't have ROW_ID column, so I have to create this Row_id dynamically.  

    Please suggest me how to do it.  Thank you.

  • A quick fix would be to alter the destination table in a SQL statement, to

    set the [rec_id] column: IDENTITY(1,1) NOT NULL programatically. You

    can reset it back after copying the records.

    Cheers,

    Augustin 

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

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