Hi All,

I got a question regarding sql.

I got some data in a ms access.

There's 3 columns, namely id, name and address. Here's an example.

id    name      address
1     a            c
2     c            d
3     d            e
.
.
.
.
100

And, I need to insert a row between 1 and 2. And, the id for 2 to 100 should increment by 1. Is there a sql statment which can do that?

Thanks alot.

I have been searching google for the past few days and I couldn't get the keyword correct.

SQL usually does not do that. It wants to keep the same ID for the same record in perpetuity.

The easiest way would be to delete the numbered column, then add it again as an autonumbering field. But it must not be the field the data is sorted on, and it must not be a primary key.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.