• GilaMonster (7/19/2013)


    Migrating a DB does not reseed identities. Check for jobs that may have done so, ask other DBAs, check the max value in the table and compare it to the current identity seed.

    Actually that depends on how the migration is done.

    I saw someDB by generating a script for it to get the schema set up and all teh UDFs and SPs created, running that, and then generating a script containing something like set identity_insert <tablename> ON ;

    insert <schema>.<tablename>(<list of all columns>) select * from <oldserver>.<databasename>.<schema>.<tablename> ;

    set identity_insert <tablename> OFF ;for each table with an identity column and the same without the identity insert on/off commands for each other table.

    It would have worked (although it seems a bit of a crazy way to do it :hehe:) if only he'd remembered to add DBCC CHECKIDENT(<tablename>, RESEED) ;after the bit of script for each table with an identity column.

    Tom