I've recently come across a interesting practice where I work. I've noticed that some developers use the following way to initialize a sql server temp table:
if object_id('tempdb..#TempTbl','u') is not null drop table #TempTbl
Other teammates will use:
if object_id('tempdb..#TempTbl') is not null drop table #TempTbl
- Is there a performance difference between the 2 initializations?
- What purpose does the ,'u' piece of code serve in the first statement?
I've tried researching msdn to get more information and it doesn't seem like either statement has a real difference. They produce the same results, but I'm curious about performance or other related factors.