SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2012 Forums
 Other SQL Server 2012 Topics
 INT KEY FILD AUTOINCREMENTAL: NO CORRECT INCREMENT
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

robycave
Starting Member

2 Posts

Posted - 03/17/2014 :  07:05:23  Show Profile  Reply with Quote

Good afternoon.
I created (into a server with IIS and SQL Server 2012 Express) a table with key field type INT and IDENTITY SPECIFICATION = YES, IDENTITY INCREMENTAL=1, IDENTITY SEED=1.
When I test it from my computer client (and the asp.net application running in the computer client, but connected to the database in the Server) the autoincremental field works well. When I copy the asp.net application into the server and I run it by server address, the key filed generate a number more upper that the same application from the Client coputer. For example: from the client my key file generate the number 22, 23, 24...and so on. Form the server it generate 1045,1046 adn so on. Why? It should generate 25, 26 and so on.

James K
Flowing Fount of Yak Knowledge

3719 Posts

Posted - 03/17/2014 :  08:26:24  Show Profile  Reply with Quote
The next identity value generated depends on the value of IDENT_CURRENT. For reasons that I don't have enough information to comment on, the IDENT_CURRENT in your server is different. You can find the current IDENT_CURRENT using
SELECT IDENT_CURRENT('YourTableNameHere')
. When you insert a new row, the value assigned to the identity column would be the next one.

You may fine these pages useful:

http://technet.microsoft.com/en-us/library/ms175098.aspx
http://technet.microsoft.com/en-us/library/ms189834.aspx
http://technet.microsoft.com/en-us/library/ms176057.aspx
Go to Top of Page

robycave
Starting Member

2 Posts

Posted - 03/18/2014 :  05:47:21  Show Profile  Reply with Quote
Thank you very much James K.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

Sweden
30276 Posts

Posted - 03/18/2014 :  07:45:06  Show Profile  Visit SwePeso's Homepage  Reply with Quote
With SQL Server 2012, it's perfectly valid to have a jump in the identity sequence due to changes made by Microsoft.
See http://stackoverflow.com/questions/14162648/sql-server-2012-column-identity-increment-jumping-from-6-to-1000-on-7th-entry



Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000