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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inserting sequential numbers to existing table

Status
Not open for further replies.

anniez

IS-IT--Management
Apr 13, 2001
43
0
0
US
I have a table with 12000+ records, many duplicates.
EmpID, Date, Amt...
I need to add a field (record_number) and populate it starting with 1.. to make it a unique row.
I can add a sequence for future additions but can you tell me how to fill it now?
 
To fill it now:
Code:
-- Populate the column:
update <table> set record_number=rownum;
-- Create the sequence
select max(record_number) from <table>;
Create sequence <sequence>
 start with <max(record_number)+1>;

Or follow Dima's advice.



----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top