473,383 Members | 1,863 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Record count begin with big number

Hi I have a Table with Automatic ID numbers...
In access I delete All records by hand

When I add new record with delphi (SQL)
the number ID of record count begin with last record+1
and not with 0

Someone know the statement to reset that?

thanx for any help
Jul 20 '05 #1
2 4982
>> Hi I have a Table with Automatic ID numbers...
In access I delete All records [sic] by hand. When I add new record
[sic] with delphi (SQL) the number ID of record count begin with last
record+1 [sic] and not with 0 <<

Rows are not records; columns are not fields and tables are not files.
What about leaving the max number in the table?

DELETE FROM Tickets
WHERE ticket_nbr < (SELECT MAX(ticket_nbr) FROM Tickets);

I assume that you are using "(SELECT MAX(ticket_nbr) FROM Tickets) + 1"
to get the next number.

This woudl avoid the proprietary, non-relational, non-deterministic
IDENTITY "feature" in T-SQL.

--CELKO--
===========================
Please post DDL, so that people do not have to guess what the keys,
constraints, Declarative Referential Integrity, datatypes, etc. in your
schema are.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #2

"Deamond" <bariko@des_oon.net> wrote in message
news:Qs*******************@news.siol.net...
Hi I have a Table with Automatic ID numbers...
In access I delete All records by hand

When I add new record with delphi (SQL)
the number ID of record count begin with last record+1
and not with 0

Someone know the statement to reset that?

thanx for any help


I guess you're talking about a table with an IDENTITY column? if so, then
the easiest way to do this is TRUNCATE TABLE - that will delete all the
rows, and also reset the identity seed.

An alternative is to use DBCC CHECKIDENT (see Books Online), which will
allow you to set the seed to any value you want.

Simon
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Hari Om | last post by:
Here are the details of my error log files: I execute the command and get following message at console: ---------------------------------------------------------------------- ../sqlldr...
6
by: 6thirty | last post by:
Hi, I've created a stocktaking database using Access XP. This is indexed by two fields - part number and shelf location. I am currently inputting all the data via a form. When I have entered a...
6
by: Mike Conklin | last post by:
This one really has me going. Probably something silly. I'm using dcount for a report to determine the number of different types of tests proctored in a semester. My report is based on a...
1
by: Scott269 | last post by:
So I've got an old MS Works database I imported into Access. I needed a primary key so I created a record number field that was just the record number I manually inserted when I entered it in the...
3
by: Mihaly | last post by:
I want to update a record into a table in SQL Server 2000 database from C#. This table is used concurently for other users too, and I want to be sure that from the read of record to the update no...
20
by: Bryan | last post by:
hello all... im trying to add a record to an sql db on ms sql server 2000, using vb.net. seems to be working.. except for one thing, one of the columns in the database is a bit datatype, and...
3
by: liberatingathena | last post by:
I'm writing you from Alajuela, Costa Rica. It's 4:30 in the morning here and I'm reaching a point of pure desperation as I've been searching the internet all night for a solution. I am not an...
22
by: RayPower | last post by:
I'm having problem with using DAO recordset to append record into a table and subsequent code to update other tables in a transaction. The MDB is Access 2000 with the latest service pack of JET 4....
2
by: Catch_22 | last post by:
Hi, I have a stored procedure that has to extract the child records for particular parent records. The issue is that in some cases I do not want to extract all the child records only a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.