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 |
|
henrikop
Constraint Violating Yak Guru
280 Posts |
Posted - 2001-04-26 : 12:16:56
|
| Hiya,I don't find the exact information I am looking for in the help of query analyzer. So I ask here :-)This is just an example, I have a table:Table: AttributeIDName Earnings (Money)Paid (Money) DECLARE rsAttribute CURSOR FOR Select ID, Name, Earnings, Paid FOR UPDATE OF PaidOPEN rsAttributeFETCH NEXT from rsAttribute INTO @ID, @Name, @Earnings, @PaidWHILE @@FETCH_STATUS = 0 Begin -- Here's the crux of my problem how dow I change -- @Paid so it's changed in the table? SET @Paid = 1500 -- Doesn't work -- OR UPDATE Attribute SET Paid = 1500 FROM Attribute WHERE CURRENT OF rsAttribute -- ??? FETCH NEXT from rsAttribute INTO @ID, @Name, @Earnings, @Paid EndThx, for your help!Question 2: Robvolk write that you don't need to use a cursor ever. How's that?I mean: when you need to make some calculations and some IF's you need the space from a cursor to do this??Henri |
|
|
|
|
|