Click here to Skip to main content
15,992,699 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi guys,

i have created one stored procedure, where i have declare one @temptable table n inserting n fetching rows from it.

My question is,

i have created this @temptable in which i'm inserting data n fetching it.
does it take the memory,
do i have to delete the rows n table..

stored procedure:
DECLARE @MaxDate DATE

SELECT @MaxDate = MAX(JobDate) from tbl_etsjob where JobDate <= @ReportDate

print @MaxDate

insert into @TempTable
select 
	  JobID,
	  UnitID ,
      DepartmentID ,
      JobDate ,
      UnitStatus ,
      Rig ,
      Well ,
      JobProcess ,
      NPSJob ,
      CrewStatus ,
      Operator ,
      js.JobStatus
from tbl_etsjob j
INNER JOIN tbl_JobStatus js on js.Ets_JobID = j.JobID
where JobDate = @MaxDate


i have to delete statement are fetching or not.?? to free the memory

plz let me know


Thanks
Posted
Updated 13-Sep-14 20:25pm
v4

1 solution

Temporary tables are automatically discarded when the session that created them is completed, so there is no need for you to explicitly delete them.

However, this normally applies to # prefixed tables (or ## prefixed global tables) - so it will depend to an extent on what is in your @temptable variable!
 
Share this answer
 
Comments
abdul subhan mohammed 14-Sep-14 4:08am    
thanks
OriginalGriff 14-Sep-14 4:20am    
You're welcome!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900