General information
Forum:
Microsoft SQL Server
Title:
Delete row from cursor....only!
I want to delete a row from a cursor I'm using. I DO NOT want to delete this record from the table I got the data for the cursor from. All articles I have found say it deletes the row in the table as well. Is there anyway to just delete the cursor row?
open a_item
fetch next from a_item into @giveid,@item,@freqindays
--run through the cursor
while @@fetch_status = 0
begin
--preform function
if ((select max(invdte) from pkpro..artran where item = @item and custno = @custno) > dateadd(day,-@freqindays,getdate()))
begin
delete from a_item where current of a_item
end
else
begin
select @giveid,@item
end
--fetch the next record
fetch next from a_item into @giveid,@item,@freqindays
--end and close the cursor
end
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only