Update cursor in stored procedure
Posted on 2006-05-22
I need a stored procedure which updates a GROUPID column in my ACCOUNTS table. I need to pass the stored procedure a parameter which will be the batchsize. So If I have 1m records in my ACCOUNTS table and I pass the stored procedure the parameter of 100,000. I need ten different values to be populated in the GROUPID column. So:
The first 100,000 records in ACCOUNTS have GROUPID = 1
The second 100,000 records in ACCOUNTS have GROUPID = 2
and so on, until GROUPID is updated for all records in the table.
The ACCOUNTS table can potentially have 10's of millions of records so ideally I'd like to put an update cursor into the stored procedure. Is this possible?