After taking the backup of database, when i tried to restore it, the seed of identity is reset to 0
. So when i try to insert any new values, the id
(primary key) is started 1
.
Now the issue is, i have relational data tables. let say from table x
after some operation the data is moved to table y
. But as the seed is set to 0, the values of id of table x
and table y
clashes. and that gives me error.
Is there a any way while taking the backup, we can save the value of identity also.
P.S. :
- size of database is huge and manual alteration is next to impossible.
- seed of identity is reset to
0
only when the table is empty.
Edit :
Sorry for a bit confusion, by backup, i mean export (my bad). as the empty tables's seed is set to default, primary key in my tables are clashing, so with export of database, i need to store the values of identity of every table also.
Is there any way i can do that ?