Information générale
Forum:
Microsoft SQL Server
Titre:
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
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement