473,320 Members | 2,054 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,320 software developers and data experts.

restart sequence number

Hi,

How to restart sequence number once the data is imported/loaded into
the tables?

Please advise.

regards
Jignesh

May 15 '06 #1
5 28349
ALTER SEQUENCE <seq> RESTART WITH <restart value>

Serge has posted lots of messages regarding this in this group. Please
search.

cheers...
Shashi Mannepalli

May 15 '06 #2
Appreciate your reply.

I have lots of columns (for several tables) for which i have defined
the column as identity column. Once the data is loaded, i need to set
the next available number for the new data to get inserted.

I can set the sequence number by: "alter table alter column restart
with ...." command but to do this i need to first get the max.
available number for the column and then i have to use to above command
to set it. This is very time consuming.

Is there anyway using SQL, where i can get the max. number using SQL
and set the next available number eg:( max(number)+1) within the SQL
body itself.

Any suggestion would be of great help.

Thank for your time
Regards
Jignesh

May 15 '06 #3
Try putting this in a shell script.

cheers...
Shashi Mannepalli

May 16 '06 #4
Shashi Mannepalli wrote:
Try putting this in a shell script.

cheers...
Shashi Mannepalli

Here is a link to past post with a procedure doing the job:
http://groups.google.com/group/comp....d0bc619a182ce6

Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
May 16 '06 #5
>> How to restart sequence number once the data is imported/loaded into the tables? <<

The kludge is ALTER SEQUENCE.

The right answer is that you should not have to do a re-sequence. This
will change the values in that column, and thus the meaning of the
rows.

Surely you did not use this as an exposed physical locator to mimic a
magnetic tape file! It must have meaning in your data model and not in
the physical storage for this to be a relational design.

May 17 '06 #6

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

Similar topics

35
by: Traci | last post by:
If I have a table with an autonumber primary key and 100 records and I delete the last 50 records, the next record added would have a primary key of 101. Is there any way to have the primary key...
3
by: John A Grandy | last post by:
In ASP.NET 1.1 and/or 2.0 ..... Is it possible to configure a web-app so that replacement of an .xml file ( physically located under the virtual dir root ) with a newer version of the file...
18
by: Bruno Baguette | last post by:
Hello, I have to design a table wich will store some action reports. Each report have an ID like this 1/2004, 2/2004, ... and each years, they restart to 1 (1/2004, 1/2005, 1/2006,...). So, I...
5
by: Eric E | last post by:
Hi, I have a question about sequences. I need a field to have values with no holes in the sequence. However, the values do not need to be in order. My users will draw a number or numbers from...
4
by: shorti | last post by:
Can anyone explain in greater (and more comprehensive) detail what the RESTART option does in the ALTER TABLE table ALTER COLUMN statement. This is the description in Info Center: RESTART or...
5
by: Jay | last post by:
In a sub procedure how do I recall/restart the sub and maintain the position in a loop? Eg (this doesnt work how I need it to work)... sub Get_Language() 'code here to prompt the user to do...
6
by: Defcon2030 | last post by:
<bHey, can someone help me with this? I've been working on it for a few days now, and my head's starting to spin... </b> // FILE:ex1_imp.cxx // // // // CLASS IMPLEMENTED: sequence (see ex1.h...
1
davydany
by: davydany | last post by:
Hey guys...a n00b Here for this site. I'm making a sequence class for my C++ class. And The thing is in the array that I have, lets say i put in {13,17,38,18}, when i see the current values for the...
5
by: David Thielen | last post by:
Hi; We keep having to restart IIS after ASP.NET kills it. Below is what we have in the event log. Any idea what the problem is? thanks - dave Event code: 3003 Event message: A validation...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.