Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Anybody See My Error
Message
 
À
Tous
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Titre:
Anybody See My Error
Divers
Thread ID:
00970166
Message ID:
00970166
Vues:
63
Below is a code snippit from a stored procedure I'm trying to build (Actually trying to get it to run in the QA), but I'm getting an error on the END startment at bottom. If I take out the insert statement, it runs without error, of course I get no records. Thanks in advance
-- Open our cursor and determine how many rows are in it
Open ScheduledCases
set @Records=@@cursor_rows

-- Loop Through the Cursor
while (@ctr <= @Records)
BEGIN
   fetch ScheduledCases into @c_CaseDate,@c_PrimarySurgeon,@c_ProceduresOnCase,@i_ProcedureCount,@c_RoomName,
         @c_EnterOR,@c_ProcStart,@c_ProcEnd,@c_ExitOR,@c_ScheduledStart,@b_isCancelled,@t_CancelledDate,@i_RoomMinutes,
	 @i_ProcMinutes,@i_deptID

   -- Increment the counter
   SET @Ctr = @Ctr+1
   -- Determine if the room name has changed
   IF (@c_RoomName<>@LastRoomName)
     BEGIN
       set @bFlag=1
     END
   ELSE
     BEGIN
       SET @bFlag=0
     END

   -- Set our RoomVariable to Last Record Value
   set @LastRoomName=@c_RoomName

   -- Insert the Record into the outputtable
   Insert into #OutPutTable (@c_CaseDate,@c_PrimarySurgeon,@c_ProceduresOnCase,
       @i_ProcedureCount,@c_RoomName,@c_EnterOR,@c_ProcStart,@c_ProcEnd,@c_ExitOR, 
       @c_ScheduledStart,@b_isCancelled,@t_CancelledDate,@i_RoomMinutes, 
       @i_ProcMinutes,@i_deptID,@bFlag)

END
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform