According to your description, my understanding is that you would like to use cursor to update each record data, if so please to refer to the following code:
declare c_cursor cursor--declare your cursor
for select id from Student
declare @id int
open c_cursor
fetch next from c_curosr into @id --fetch your first record value
while(@@FETCH_STATUS=0)
begin
update Student
set name = 'hi'
where id=@id
fetch next from c_curosr into @id
end
close c_cursor--close your cursor
deallocate c_cursor--deallocate your cursor
None
0 Points
86 Posts
Cursor in Access table
Aug 10, 2013 06:19 AM|raj1947|LINK
I need to manipulate the row in field by using cursor.(supose 250 record means i need to change the particular field in each row)
Star
12777 Points
1635 Posts
Re: Cursor in Access table
Aug 12, 2013 06:03 AM|Terry Guo - MSFT|LINK
Hi raj1947,
According to your description, my understanding is that you would like to use cursor to update each record data, if so please to refer to the following code:
If you have any question please let me know.
Best Regards,
Terry Guo