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

updating table with an incremental unique number

Status
Not open for further replies.

Distraction

Technical User
Jan 30, 2004
25
US
Hello!

I am making some updates to a table, but can't because of a unique constraint.

I have some 'empty' columns that I can use to assign a unique number to, so that then I can make my other updates.

Is there a quick and easy way to update this empty column assigning a unique (or incremental) number to each row?
 
You can probably use the RANK function to add a number to each row.

What I don't know is if you'll need a temp table to assign the RANK and then update the base table, or if you can update the base table directly.
 
Well, I ended up recreating the table with an Identity column then selecting * into it.

Not the workaround I was looking for, but effective in this situation.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top