Solved

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

Posted on 2006-07-05
1
230 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Unable to connect C# program to an SQL database - Exception occurs. 4 61
MailAddress in vb 4 36
ASP.NET - Why is accordion not working? 3 50
Problem to copy file 14 53
Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

726 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