473,803 Members | 3,725 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3013
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
3848
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 returned autogenerated Identity is wrong (on the VB side). This only occurs if the length of the value inserted for the text column is >= 8002. I've included a simple example below.
1
2766
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 icreases the update time by a factor of 10 and when your talking about 200,000 inserts its way to long). Is there a way to insert the record into multiple tables in one statement where you can use the value of the auto incremented field as the...
26
5409
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 to that element so
3
3090
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 invalidating the iterator? This ominous statement in the STL "set" documentation makes me worried. I saw no similar statement on the "hash_multiset" docs. "Erasing an element from a set also does not invalidate any iterators, except, of course, for...
2
3851
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, SCOPE_IDENTITY - @@IDENTITY returns the value from the very LAST insert on any table
0
1287
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 been fixed and also a lot of bugfixes were implemented, especially for unicode. You can read more on the SPE news blog. If you like SPE, please contribute by coding, writing documentation or donating. Spread the word on blogs, ...
9
5217
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); vector<double>::iterator i=x.begin()+2, j=x.begin()+6; x.erase(i,j); // i<j, ok, erases 4 elements. x.erase(j,i); // j>i, no error, just inserts 4 elements.
11
5541
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 ( i->second < 0 ) m.erase(i);
5
2731
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
1723
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 of UDT. Correct me if am wrong. Well, if we insert a null pointer into a set, wouldn't it cause an error whenever the container would try to invoke its member.
0
9566
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10555
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10300
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10069
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7607
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6844
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4277
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3802
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.