Reseed identity columns?

Automate and integrate using the SQL comparison API

Moderator: Chris Auckland

Reseed identity columns?

Postby ssobolev » Wed Jan 14, 2009 6:19 pm

I currently have database update procedure implemented using SQL Compare/Data Compare API.
General algorithm is like this:
1. Create new database from script folder using SQL Compare API
2. Fill it with base set of data
3. Compare database structure for new database and existing one;
4. Apply additions to existing database
5. Compare data in existing database with new one using SQL Data Compare API
6. Apply any additions/significant changes to existing database from new one
7. drop temporary database

This process does reset identity seeds on existing database. Is there any way to reseed them properly, whitout using "DBCC CHECKIDENT"?
ssobolev
 
Posts: 3
Joined: Thu Jul 17, 2008 5:46 pm

Postby Ben Pinchen » Mon Jan 19, 2009 6:13 pm

Are you using the default SqlOptions enumeration? This includes the option 'Reseed Identity columns'. If you don't want to use this option then you'll have to explicitly call the options that you want to use leaving the option to 'Reseed Identity Columns' out. You can find information about sqloptions from http://help.red-gate.com/help/SQLDataCo ... /index.htm
Ben Pinchen
 
Posts: 157
Joined: Thu Dec 28, 2006 1:21 pm
Location: Red Gate

Postby ssobolev » Mon Feb 09, 2009 4:03 pm

Haven't had the chance to check it with API v7 till today.
It is the same with v6 and v7, if I put in Reseed Identity Column option, it reseeds this column not to the CORRECT value, but to zero.
Here is an example of generated code:
-----------------
-- Reseed identity on [dbo].[Customers]
DBCC CHECKIDENT('[dbo].[Customers]', RESEED, 0)
GO
-----------------

How can I make it to look like
-----------------
-- Reseed identity on [dbo].[Customers]
DBCC CHECKIDENT('[dbo].[Customers]', RESEED)
GO
-----------------
without manually processing SQL code? is there an option to force such reseed ?
ssobolev
 
Posts: 3
Joined: Thu Jul 17, 2008 5:46 pm


Return to SQL Comparison SDK Previous Versions

Who is online

Users browsing this forum: No registered users and 0 guests