Red Gate forums :: View topic - DBCC Checkident issue in large table
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Compare 10
SQL Compare 10 forum

DBCC Checkident issue in large table

Search in SQL Compare 10 forum
Post new topic   Reply to topic
Jump to:  
Author Message
rocapm



Joined: 17 Dec 2012
Posts: 1

PostPosted: Mon Dec 17, 2012 8:49 pm    Post subject: DBCC Checkident issue in large table Reply with quote

Hi,

I'm using SQL Compare to sync two databases in SQL SERVER 2000. It's working fine, but I'm having a performance issue with one of my tables. The sync script is adding and deleting some columns, and as the order changes, it's trying to rebuild the table. But when it is trying to run the DBCC CHECKIDENT Reseed instruction on the temp table, the script keeps working, I left it running for almost 20 hours but nothing changes. The table has more than 2000000 records, I think that is the problem.
Is there a way to skip that instruction?
The code that is getting issues is this:
Code:
DECLARE @idVal BIGINT
SELECT @idVal = IDENT_CURRENT(N'[dbo].[TocItems]')
IF @idVal IS NOT NULL
    DBCC CHECKIDENT(N'[dbo].[tmp_rg_xx_TocItems]', RESEED, @idVal)
GO


Thank you!
Pablo
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6677

PostPosted: Tue Jan 15, 2013 11:20 am    Post subject: Reply with quote

Hi Pablo,

Are you sure you want to ignore the reseed? If the table needs to be rebuilt, this ensures that the next identity value matches what was in the table originally. If you don't reseed, the current identity goes back to 1 and you could have a constraint failure on teh next insert.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group