Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi All I would like to know if i

Status
Not open for further replies.

Motlatjo

Programmer
Oct 11, 2011
76
ZA
Hi All

I would like to know if it is possible to set the Start With of a Sequence as a max value of an Integer field in a table?
I tried to do this and i could not get it:

CREATE SEQUENCE MySeq
AS INT
START WITH (SELECT MAX(ID) FROM TABLE1)
INCREMENT BY 1
NO MAXVALUE
NO CYCLE
CACHE 200
ORDER;

Thanks in advance
 
Hi,
I don't think you can specify START in this fashion. I believe you might be able to achieve this usingand insert into the table using NEXTVAL but am not sure, so you'd have to look into this.

Marc
 
Hi Marc

The issue is that i'm doing this in different servers, I ran The first Sequence in the first server1 (Next Value for Sequence1, so after extracting the data, i exported it to a table in another table in another server2, So there is a Sequence that generate the ID column of this table, so i need to tell the Sequence to Take the MaxValue of the ID in the table, as the Start value.

Thanks in advance
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top