Wednesday, March 21, 2012

Reseed Identity of Existing

Hey all,
Is there an easy way to reseed an identity column while retaining all of
the data within each row?
This doesn't really make much of a difference since it doesn't affect
anything 'operationally'; just curious more than anything else.
I read several posts here and checked DBCC_CHECKIDENT but wasn't sure about
the impact to existing.
Thanks.
Message posted via http://www.droptable.com
DBCC CHECKIDENT ('table_name', RESEED, new_reseed_value)
As long as you don't reset it to a value lower than the maximum existing
identity value, you are ok.
Regards
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"The Gekkster via droptable.com" <forum@.nospam.droptable.com> wrote in
message news:c25abe6eaa404a5b8ef9e7aff85038f2@.droptable.co m...
> Hey all,
> Is there an easy way to reseed an identity column while retaining all of
> the data within each row?
> This doesn't really make much of a difference since it doesn't affect
> anything 'operationally'; just curious more than anything else.
> I read several posts here and checked DBCC_CHECKIDENT but wasn't sure
> about
> the impact to existing.
> Thanks.
> --
> Message posted via http://www.droptable.com
|||Thanks, Mike.
I was actually wondering about the ability to 'include' existing rows. In
other words, to also automatically 're-number' existing rows beginning with
the RESEED value used in executing DCCC_CHECKIDENT.
Message posted via http://www.droptable.com

No comments:

Post a Comment