Re: How to define cursor on temp table?

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Partha Mandayam (mcp111_at_hotmail.com)
Date: 08/24/04


Date: Tue, 24 Aug 2004 08:52:35 -0700

I have used local temp tables successfully in a cursor.
Check this out.

select top 10 claimid, startdate into #temp
from claim

DECLARE cur1 CURSOR

FOR select * from #temp

DECLARE @claimid varchar(15)
DECLARE @startdate datetime
OPEN cur1

FETCH NEXT FROM cur1 INTO @claimid, @startdate
WHILE (@@fetch_status <> -1)
BEGIN
        IF (@@fetch_status <> -2)
        BEGIN
        PRINT 'claimid'
-- eg.
                
        END
        FETCH NEXT FROM cur1 INTO @claimid, @startdate
END

CLOSE cur1
DEALLOCATE cur1
GO

Regards

Partha Mandayam
Software Consultant
Home page: http://partha.tripod.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Relevant Pages

  • Selecting adjacent cell
    ... The temp data starts at cell c3 and humidity starts ... Application.WorksheetFunction.Max.cell.offset' Temp ... Stopdate = Startdate + 1 ... If Startdate <= Stopdate Then ...
    (microsoft.public.excel.programming)
  • RE: Selecting adjacent cell
    ... The temp data starts at cell c3 and humidity starts ... Stopdate = Startdate + 1 ... If Startdate <= Stopdate Then ...
    (microsoft.public.excel.programming)
  • RE: sqlserver stored procedure
    ... "aditya pathak via .NET 247" wrote: ... > CREATE proc updateLangRow ... > open cur1 ...
    (microsoft.public.dotnet.languages.csharp)
  • RE: sqlserver stored procedure
    ... > CREATE proc updateLangRow ... > set nocount on ... > open cur1 ...
    (microsoft.public.dotnet.languages.csharp)
  • RE: sqlserver stored procedure
    ... declare @v1 varchar ... fetch cur1 into @v4,@v1, @v2 ... > declare @v3 int ...
    (microsoft.public.dotnet.languages.csharp)