I've got to update a column in one SQL table with a counter stored in another table, and update that

Posted by Bucket on Stack Overflow See other posts from Stack Overflow or by Bucket
Published on 2010-03-17T04:29:22Z Indexed on 2010/03/17 4:31 UTC
Read the original article Hit count: 195

Filed under:
|
|
|
|

I'm using SQL server 2005 (for testing) & 2007 (for production).

I have to add a unique record ID to all the records in my table, in an existing column, using a "last record ID" column from another table. So, I'm going to do some sort of UPDATE of my table, but I have to get the "last record ID" from the other table, increment it, update THAT table and then update my record.

Can anyone give me an example of how to do this? Other users may be incrementing the counter also.

© Stack Overflow or respective owner

Related posts about sql

Related posts about update