Positioned Updates with Transact-SQL

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Rea Peleg (reapeleg_at_barak-online.net)
Date: 04/07/04


Date: Wed, 7 Apr 2004 21:47:52 +0200

Hey EB

Can any one replace the sql update sentence below, using a positioned update
with the cursor
that is already in use??
I can't get the right syntax for using the 'WHERE CURRENT OF' clause..

TIA
Rea

////////////////////////////////////////////////////////////////////////////
///////////////

SELECT sales_date_vc FROM dates_values
For update of sales_date

OPEN dates_cursor

FETCH NEXT FROM dates_cursor
INTO @vr_date

WHILE @@FETCH_STATUS = 0
BEGIN
   SELECT @d_date = convert(datetime,@vr_date,120)
--============================================
   update sales_date_vc set sales_date = @d_date
   where sales_date = @vr_date
--============================================
FETCH NEXT FROM dates_cursor INTO @vr_date

END



Relevant Pages

  • Re: Opinions on approach, please...
    ... To emulate this I plan on using an SQL cursor. ... Is it because when you FETCH from a cursor you go back to the ... therefore the cursor cannot be referred to in Positioned UPDATE and DELETE ... I just did a test and even without specifying FOR READ ONLY I was able to ...
    (comp.lang.cobol)
  • Re: Positioned Updates with Transact-SQL
    ... Why do need a cursor to do this? ... > Hey EB ... > Can any one replace the sql update sentence below, ... > FETCH NEXT FROM dates_cursor ...
    (microsoft.public.sqlserver.programming)
  • Re: Ladegeschwindigkeit eines ListViews
    ... Der Aspekt, den Du jetzt eingebracht hast, ... den cursor, mit der Zeilennumer als key, aus dem resultset holen? ... FETCH ABSOLUTE 2 FROM myCursor ...
    (microsoft.public.de.german.entwickler.dotnet.csharp)
  • Re: Ladegeschwindigkeit eines ListViews
    ... den cursor, mit der Zeilennumer als key, aus dem resultset holen? ... FETCH ABSOLUTE 2 FROM myCursor ... ja mal ein neuer Aspekt hinzu, ...
    (microsoft.public.de.german.entwickler.dotnet.csharp)
  • Re: Opinions on approach, please...
    ... To emulate this I plan on using an SQL cursor. ... I COULD do it with a resultset if it wasn't in COBOL or could ... Is it because when you FETCH from a cursor you go back to the ...
    (comp.lang.cobol)