473,425 Members | 1,557 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,425 software developers and data experts.

How to a erase field & insert auto-increment


i have a field with a list of wrong ID (random) and i wish to replac
them with a sequential (auto-increment) value. how to remove the valu
and to add in the sequential ID?
Im a newbie in ASP! Pls Help
-
dion
-----------------------------------------------------------------------
Posted via http://www.codecomments.co
-----------------------------------------------------------------------

Jul 19 '05 #1
5 2994
diong wrote:
i have a field with a list of wrong ID (random) and i wish to replace
them with a sequential (auto-increment) value. how to remove the value
and to add in the sequential ID?
Im a newbie in ASP! Pls Help!


This is not a task for ASP. This is a task that should be done using the
maintenance tool for whatever type of database you are using. I am tempted
to guess that you are using Access from your use of the word
"auto-increment", but I would rather not waste my time. Please tell us the
type and version of database you are using.

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 19 '05 #2

Im using SQL 2000 and Microsoft Access 97..It saves on SQL and Access97
The field i use in SQL 2000 is "Idno" while in Access its "Id".

Field "Idno" in SQL 2000 is "auto-increment" while in field "Id" i
Access 97 it request and depends on the SQL 2000 "Idno" field.

I wish to replace values of the field "Id" in Access 97 with
sequential value. how to remove the value and how to add in th
sequential ID?

what if I have 150 records or even greater?...is it possible?
thanks and regard
-
dion
-----------------------------------------------------------------------
Posted via http://www.codecomments.co
-----------------------------------------------------------------------

Jul 19 '05 #3
diong wrote:
Im using SQL 2000 and Microsoft Access 97..It saves on SQL and
Access97. The field i use in SQL 2000 is "Idno" while in Access its
"Id".

Field "Idno" in SQL 2000 is "auto-increment" while in field "Id" in
Access 97 it request and depends on the SQL 2000 "Idno" field.

I wish to replace values of the field "Id" in Access 97 with a
sequential value. how to remove the value and how to add in the
sequential ID?

what if I have 150 records or even greater?...is it possible?

Open the database in Access, open the table in Design View, delete the id
column. Save. Add a new column, calling it id, and setting its type ot
AutoNumber. when you save it, the id will be sequentially numbered.

For further help, please see an Access newsgroup (unless you need help with
ASP, of course)

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 19 '05 #4

thanks for the reply..but what i want to know is I will be the who wil
input the values of the field "id" in Access 97. For example is i hav
a textbox in my ASP Page and my database table in access has 5 record
in it. I'll enter a value "12345" in the textbox.. upon pressing the o
button it will save in the id field and it will increment 5 times (u
to 12349).

thanks
-
dion
-----------------------------------------------------------------------
Posted via http://www.codecomments.co
-----------------------------------------------------------------------

Jul 19 '05 #5
diong wrote:
thanks for the reply..but what i want to know is I will be the who
will input the values of the field "id" in Access 97. For example is
i have a textbox in my ASP Page and my database table in access has 5
records in it. I'll enter a value "12345" in the textbox.. upon
pressing the ok button it will save in the id field and it will
increment 5 times (up to 12349).

thanks!


Think about multi-user activity. If 2 users both simultaneously create a
record using "12345" as the value in that text box, both of their records
will have the same value in the id field. This cannot be what you want. Two
records with the same id?

I cannot think of a good reason for doing something like this. You will
force the data entry process to be serialized, slowing performance. Why do
you care what value is being used in the id field? Why does the value need
to be tied to the number of records existing in the database at the time the
record was created? The only requirement for an id value should be that it
is a unique value.

Please explain your requirements a little better. I suggest you do a little
reading about database design.

Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #6

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

Similar topics

4
by: Dan | last post by:
I've run into an interesting problem, and seemed to have stumped 3 newsgroups and 2 other forums. For some reason when I try to insert a record into a SQL table that has a Text column, the...
1
by: Ryan Hubbard | last post by:
I'm inserting a record into MySQL 4.0 using Visual Basic ADO. When using the AddNew and Update method I am unable to retrieve the value of a Auto incrment field (Yes I know I can MoveLast but this...
26
by: Pieter Thysebaert | last post by:
Hello, I've got a question conerning erasing key-value pairs from a std::map while iterating over it. According to the STL docs, erasing an element in a map invalidates all iterators pointing...
3
by: Kenneth Massey | last post by:
Is the following code guaranteed to work? I have a hashed set of pointers, which I would like to selectively delete from. Can I iterate through the set, deleting certain ones, without...
2
by: Eugene | last post by:
Hi, Problem: I need to get the value of auto-incremented field from just inserted record In Oracle this is INSERT .. RETURNING command. In SQL Server there are @@IDENTITY, IDENT_CURRENT,...
0
by: SPE - Stani's Python Editor | last post by:
What's new? SPE now creates backup files and can insert your standard signature (with for example license and copyright information) in your code. A bug that prevented SPE to start on Linux has...
9
by: Amadeus W. M. | last post by:
I have a vector from which I want to erase elements between iterators i,j. If i<j, everything works as expected, but if j>i, an insertion is actually performed. Example: vector<double> x(10);...
11
by: moleskyca1 | last post by:
Hi, I know if you call erase when you iterate through map you will crash. Ex: map<int,doublem; // insert something for ( map<int, double>::iterator i = m.begin(); i != m.end(); i++ ) if (...
5
by: Boltar | last post by:
Hi Is there a way of inserting and erasing to/from a vector using an array index instead of an iterator or alternatively a way to map an index number to an iterator? eg: vector<intv;
2
by: puzzlecracker | last post by:
I meant something else entirely. I was refering to algorithms, such as find_if where passed predicate, which implemented operator () for comparison. I assume set uses operator == to locate elements...
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.