cursor for updating records is sqlserver 2005

1 view
Skip to first unread message

Meet

unread,
Jan 13, 2011, 1:12:25 PM1/13/11
to DotNetProfessionals-Group
use tennis
go
declare @states nvarchar(100)
declare @c1 cursor
set @c1= cursor for select state from usertable for update of state
update usertable set state='Kanpur' where current of @c1
open @c1

fetch next from @c1 into @states
WHILE @@FETCH_STATUS = 0
BEGIN
print @states
update usertable set state='Kanpur' where current of @c1
fetch next from @c1 into @states

end
close @c1
deallocate @c1
Reply all
Reply to author
Forward
0 new messages