By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,651 Members | 1,757 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,651 IT Pros & Developers. It's quick & easy.

How to a erase field & insert auto-increment

P: n/a

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
Share this Question
Share on Google+
5 Replies


P: n/a
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

P: n/a

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

P: n/a
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

P: n/a

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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.