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 |
|
oana4
Starting Member
3 Posts |
Posted - 2004-11-30 : 15:23:02
|
| Hi,I have this cursordeclare x cursor forselect a,bfrom dOPEN x FETCH NEXT FROM x INTO @OBJ,@OBJTYPE WHILE @@FETCH_STATUS = 0 begin set @UPDATE='update d'+'set m '+'='+''''aa'''' EXEC sp_executesql @UPDATE FETCH NEXT FROM x INTO @OBJ,@OBJTYPE end CLOSE x DEALLOCATE x And I have this error - A cursor with the name x already exist.Which is the problem?Thanks |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2004-11-30 : 15:30:55
|
| You must have run your code and received an error so it aborted. So CLOSE x and DEALLOCATE x have not run. So just run those two lines of code, then try running the entire thing again.Not sure why you think you need a cursor and dynamic SQL for this though.Tara |
 |
|
|
|
|
|