cursor

Who is online?  0 guests and 0 members
Home  »  Forums   »  microsoft business intelligence   »  sql server   » cursor

cursor

Topic RSS Feed

Posts under the topic: cursor

Posted: 4/18/2012

Padawan 378  points  Padawan
  • Joined on: 4/3/2012
  • Posts: 189

hi

 

i need to put fetch next in my cursor.its goig endless.

declare @P1 nvarchar(32)
declare @mtd2 float


declare c1 CURSOR FOR 
select account, MTD from #temp2


open c1

FETCH NEXT FROM c1 
INTO @P1,@mtd2



WHILE @@FETCH_STATUS = 0
begin



if(@mtd2 IS NULL ) 
BEGIN

declare @IRR2 float







EXEC pdashboard





select @IRR2 = IRR from pdashboard

SELECT @IRR2 as Last1month


END

ELSE 
BEGIN
select @mtd2 as last2month 






END

fetch next from c1 into @P1,@MTD2


END

where do i need to put ?


Posted: 4/19/2012

Jedi Knight 2338  points  Jedi Knight
  • Joined on: 2/22/2010
  • Posts: 209

Just out of curiosity, what is it you're trying to accomplish? Depending on what your needs are, might be easier implementation than cursor.


Posted: 4/20/2012

Padawan 378  points  Padawan
  • Joined on: 4/3/2012
  • Posts: 189

got solve .thanks


Page 1 of 1 (3 items)