How do I clear/reset/drop temporary created table that is in loop?
Another loop at the top with extra code...
How do I reset/drop the declared table up here or below?
Declare @Aresource table(idr int identity(1,1), id int)
Insert into @Aresource (id)
SELECT idr = AssignmentImageId
FROM VLP2014..Assignment
Where AssignmentId = @ida
Declare @ari int
Declare @aricnt int
select @ari = min(idr) - 1, @aricnt = max(idr) from @Aresource
While @ari < @aricnt
Begin
Select @ari = @ari + 1
Declare @arid int
select @arid = id from @Aresource where idr = @ari
How do I reset/drop the declared table here?
some more code...
I have tried the normal DROP TABLE if exists but since it is Declared (temp table) I cant seem to be able to call it.