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 |
|
1sabine8
Posting Yak Master
130 Posts |
Posted - 2007-12-13 : 04:23:16
|
| Hi i have a cursor in a Stored Procedure. The problem is that it's poiting to the first row and causing an infinite loop on it.How can i stop this and make it go to all rows. Here is my code.Declare @CountTSCourtesy intDeclare @WaiterName nvarchar(100), @CursorRestaurantName nvarchar (100)Declare waiter_cursor CURSOR FORSELECT new_waiteridname, new_restaurantnameFROM dbo.FilteredNew_CommentCardWhere new_dateofvisit between @FromDate and @ToDate and new_restaurantname = @RestaurantOpen waiter_cursorFETCH NEXT FROM waiter_cursorinto @WaiterName,@CursorRestaurantNameWhile @@FETCH_STATUS=0BEGINExec WaitersCountExCourtesy @WaiterName,@CursorRestaurantNameENDClose waiter_cursorDeallocate waiter_cursorEND Thanks in advance... |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-12-13 : 04:37:17
|
quote: Originally posted by 1sabine8 Hi i have a cursor in a Stored Procedure. The problem is that it's poiting to the first row and causing an infinite loop on it.How can i stop this and make it go to all rows. Here is my code.Declare @CountTSCourtesy intDeclare @WaiterName nvarchar(100), @CursorRestaurantName nvarchar (100)Declare waiter_cursor CURSOR FORSELECT new_waiteridname, new_restaurantnameFROM dbo.FilteredNew_CommentCardWhere new_dateofvisit between @FromDate and @ToDate and new_restaurantname = @RestaurantOpen waiter_cursorFETCH NEXT FROM waiter_cursorinto @WaiterName,@CursorRestaurantNameWhile @@FETCH_STATUS=0BEGINExec WaitersCountExCourtesy @WaiterName,@CursorRestaurantNameFETCH NEXT FROM waiter_cursorinto @WaiterName,@CursorRestaurantNameENDClose waiter_cursorDeallocate waiter_cursorEND Thanks in advance...
Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
|
|
|