[dba-SQLServer] Appending Data with AutoNumber in SQL Server

David McAfee davidmcafee at gmail.com
Thu Jun 5 11:24:53 CDT 2014


Are you inserting the PK too?

If you are bring the PK from table 1 into table 2, make sure the PK for
Table 2 isn't an auto-incrementing Identity

or

If you aren't bringing the PK over, make sure that the PK in table 2 IS an
IDENTITY(1,1) especially if table 2's PK column is set to not allow nulls




On Thu, Jun 5, 2014 at 8:55 AM, Jeff B <jeff.developer at gmail.com> wrote:

> I am going to post this in the Access group as well, as a separate email.
>
>
>
> I am trying to use MS Access queries to append data from a table in one SQL
> database into a table in a second SQL database.  The first contains live
> data that needs to be moved to a test database.  I have deleted all of the
> data from the tables in the second database, and have reset the auto number
> (or identity in SQL) back to 0.  However, when I try and use an Access
> append query, it fails and tells me there are key violations.  I thought
> that be deleting all data and reseeding the identity, I would avoid these
> problems.  Anyone know what I need to do in order to make this work?
>
>
>
> Jeff Barrows
>
> MCP, MCAD, MCSD
>
>
>
> Racine, WI
>
> jeff.developer at gmail.com
>
>
>
> _______________________________________________
> dba-SQLServer mailing list
> dba-SQLServer at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
> http://www.databaseadvisors.com
>
>


More information about the dba-SQLServer mailing list