I am using cursor to pass the each employee wise information to do some calculation inside,
I have used some temp table with the declaration like
declare @tempTask1 table(emplid nvarchar(10), Values bigint)
and storing it into the main table
insert into Maintable
Select * from @tempTask1
but what happens is when the loop goes the emplid
is kept on adding into the @tempTask1
.
like example
E1 1001
E2 1002
...
as per the no of times the loop goes
so duplicate entry exists for each record and calculation failed.
How to drop this temp table and recreate the emp table used inside the loop to avoid these data problems.
Note: each loop shld take only unique emplid one time when it loops
您可以使用删除语句
DELETE @tempTask1
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.