question

ruancra avatar image
ruancra asked

T-SQL Reseed query

Hi all Our dba replicated a database instead of doing a backup and restore. Now the identity fields in all tables are reset to 1 when doing a insert, meaning when a new row is inserted the id field starts at 1. How can i write a query to reset the seed to start at the max id +1? Using SQL2008R2 Thanks Ruan
tsql
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
sqlaj 1 avatar image
sqlaj 1 answered
Look at this site. It shows a good example of what you (or they) need to do. http://blog.sqlauthority.com/2012/08/24/sql-server-delete-truncate-and-reseed-identity/
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.