Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
hmusa
Starting Member
36 Posts |
Posted - 2001-03-29 : 08:36:04
|
I have the following update statement that i am using to update a table from another:update testing1set student_id = (select student_id from testing2 where stagecode ='p01')where check ='1 'works finebut i have over 300 records that i need to update, i thought a cursors could be used, so i used the following code, i've never used cursors and the folowing code will show declare @student_id char (11)declare mycursor scroll cursorfor select student_id from testing2 where stagecode = 'p01 'open mycursorfetch first from mycursorinto @student_idwhile @@fetch_status = 0beginupdate testing1set student_id = @student_idwhere [check]= '2 'fetch next from mycursorendclose mycursordeallocate mycursorit obviously does not work, can anyone help.thanxs |
|
|
|
|
|