Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Update
Message
De
04/01/2005 18:53:33
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Titre:
Re: Update
Divers
Thread ID:
00974228
Message ID:
00974242
Vues:
19
Mahmood,

You need another FETCH inside your loop:
Fetch Next From TableCursor into @ActID,@TranAmt
While @@Fetch_Status = 0
Begin
   UPDATE QW2_ROLLUP_TABLE
      SET New_Tran_Amt = @TranAmt
      Where Activity_ID = @ActID
   Fetch Next From TableCursor into @ActID,@TranAmt
End
~~Bonnie


>Hi All:
> I am trying to update one of the filed in my sql table. I need to update only one row in this table.
>
>this is my code
>
>Set RowCount 1
>
>Declare @ActID Varchar(15)
>Declare @TranAmt Money
>
>
>Declare TableCursor Cursor For
> Select Activity_ID,Tran_Amt From QW2_ROLLUP_TABLE GROUP BY ACTIVITY_ID, TRAN_AMT
>
>Open TableCursor
>Fetch Next From TableCursor into @ActID,@TranAmt
>While @@Fetch_Status = 0
>Begin
> UPDATE QW2_ROLLUP_TABLE
> SET New_Tran_Amt = @TranAmt
> Where Activity_ID = @ActID
>End
>Close TableCursor
>Deallocate TableCursor
>
>When this finish executing, none of the row in this table is updated. Please tell me what am I doing wrong?
>Thanks
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform