December 11, 2024 at 5:38 pm
I have query which is filling TEMPDB
I need suggestion how to modify this query to which can minimize the TEMPDB space to fill
update #TempShow1
set Name = case when a2.ID is NULL then a1.name else a2.name end,
Address = case when a2.ID is NULL then a1.Address else a2.Address end,
State = case when a2.ID is NULL then Student.dbo.Mark(a1.state) else student.getClean(a2.state) end
from #TempShow1 t left join #INFO a1
on t.clientID = a1.clientID
and a1.Type = 1
left join #INFO a2
on t.ID = a2.ID
and a2.type = 2
December 11, 2024 at 5:57 pm
I have query which is filling TEMPDB
I need suggestion how to modify this query to which can minimize the TEMPDB space to fill
update #TempShow1 set Name = case when a2.ID is NULL then a1.name else a2.name end, Address = case when a2.ID is NULL then a1.Address else a2.Address end, State = case when a2.ID is NULL then Student.dbo.Mark(a1.state) else student.getClean(a2.state) end from #TempShow1 t left join #INFO a1 on t.clientID = a1.clientID and a1.Type = 1 left join #INFO a2 on t.ID = a2.ID and a2.type = 2
Use a permanent table instead of #TempShow1.
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
December 11, 2024 at 5:59 pm
Ok thanks I will try
December 11, 2024 at 6:11 pm
Nita Reddy wrote:I have query which is filling TEMPDB
I need suggestion how to modify this query to which can minimize the TEMPDB space to fill
update #TempShow1 set Name = case when a2.ID is NULL then a1.name else a2.name end, Address = case when a2.ID is NULL then a1.Address else a2.Address end, State = case when a2.ID is NULL then Student.dbo.Mark(a1.state) else student.getClean(a2.state) end from #TempShow1 t left join #INFO a1 on t.clientID = a1.clientID and a1.Type = 1 left join #INFO a2 on t.ID = a2.ID and a2.type = 2
Use a permanent table instead of #TempShow1.
Or make tempdb bigger.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply