SQLTeam.com | Weblogs | Forums

T-sql 2012 temp table


#1

In some new t-sql 2012 that I am going to be setting up, I will be loading some data into #temp tables. I will be then joining the #temp tables to the main query that I will be executing. There will be times when one or two of the #temp tables may not have any data in them. Thus I am not certain how to handle this situtation. Would I just join to the main query with a left join? Would I need some if then else logic?

Thus would you show me some t-sql 2012 that would solve my problem for me?


#2

A temp table created with a single pound sign, #temp, is only visible to the session that created it so writing a script using temp tables it is possible to control the "fullness" of the temp tables at any given time during the script.