Solved

how can i get the id update num from sql 2000 ?

Posted on 2006-07-05
1
226 Views
Last Modified: 2010-04-16
hi there ,

i have a DB whit an id row in it
this row are an Identity type that increment val are 1 .

if there was a data that i have been deltet from the DB
the id still remmber the last num he was
but in the first view i all geeting id=1
after update the id num returns to the last number he was befor the db delte.

i want to know the real number always
0
Comment
Question by:Tech_Men
1 Comment
 
LVL 23

Accepted Solution

by:
apresto earned 300 total points
ID: 17040831
This always happens, unless you insert the id's manually you cannot get around this.

Imagine you have this:

Id             field

1               icecream
2               worldcup
3               italy
4               pancake
5               blah
6               something

if you deleted worldcup and italy you would have:

1               icecream
4               pancake
5               blah
6               something

Unless you insert the ID yourself using something like this:

DECLARE @id int
SET @Id = (SELECT Max(Id) FROM Table) + 1

INSERT INTO Table (Id, field) VALUES (@Id, 'new field value' )

you cannot change the increment to reindex the lot (unless you drop the colum, and re insert it and reapply the increment )
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now