Use the information in this link in combination with a SQL function that gets the max(RID) from each table that you need to reset. For instance, if you want to start your primary key seed at 25000, use the code below (StartSeedValue - 1)
DBCC CHECKIDENT('myTable', RESEED, 24999)
So in combination, you should end up with somethink like this
DECLARE @maxVal INT
SELECT @maxVal = ISNULL(max(ID),0)+1 from mytable
DBCC CHECKIDENT('mytable', RESEED, @maxVal)
Sorry for the Pseudo-code, been awhile since I have written a SQL function :)
EDIT:
Thanks for the catch, changed the INTEGER to INT
USE YourDBName
GO
SELECT *
FROM sys.Tables
GO
This will give you a listing of all user tables in the database. Use this query as your 'loop' and that should allow to reset the seeds on all tables.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…