Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

identity column Expand / Collapse
Author
Message
Posted Monday, November 5, 2012 8:17 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Thursday, February 21, 2013 12:01 PM
Points: 149, Visits: 346
hi,

my identity column should start with 1,1 .

but when i insert data from package , it starts 1133.


even if i drop table and create again and insert data from package,it starts with 1133

any help
Post #1381106
Posted Monday, November 5, 2012 8:19 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Saturday, November 1, 2014 6:54 AM
Points: 5,221, Visits: 5,118
Check the source where the data is coming from in the package and your transformations, if your inserting a column from the source into the identity column in the destination it will take what ever the values are from the source, it wont start from 1.



Want an answer fast? Try here
How to post data/code for the best help - Jeff Moden
Need a string splitter, try this - Jeff Moden
How to post performance problems - Gail Shaw
CrossTabs-Part1 & Part2 - Jeff Moden
SQL Server Backup, Integrity Check, and Index and Statistics Maintenance - Ola Hallengren
Managing Transaction Logs - Gail Shaw
Troubleshooting SQL Server: A Guide for the Accidental DBA - Jonathan Kehayias and Ted Krueger

Post #1381107
Posted Monday, November 5, 2012 6:04 PM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Monday, September 29, 2014 5:52 AM
Points: 369, Visits: 1,215
Check the initial value before the insert:
DBCC CHECKIDENT('myTable',NORESEED)

If it is not 1, your creation script has initial value that is not 1.

To reset identity to start from 1 use this:
DBCC CHECKIDENT('myTable',RESEED,0) 

But it is better to fix the creation script.


_____________________________________________________
Microsoft Certified Master: SQL Server 2008
XDetails Addin - for SQL Developers
blog.sqlxdetails.com - Transaction log myths
Post #1381331
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse