I didn't explicitly DROP #temp at the end of a procedure, and the next time I ran it, it gave me an error message that the table was still there. I added the DROP #temp now, but I thought a temp table was automatically destroyed when the process it was created by terminated... I guess I'm wrong on this, can someone explain to me how temp tables are stored in memory?