Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
SQLBoy14
Yak Posting Veteran
70 Posts |
Posted - 2014-09-23 : 23:54:05
|
Hi sql expert,if I have five different temp tables, is that other way to handle temp tables if I stop the query in between the execution? Below are basic sample of my temp tables:SELECT AINTO #TmpTbl1FROM A tableSELECT AINTO #TmpTbl1FROM A tableSELECT BINTO #TmpTbl2FROM B tableSELECT CINTO #TmpTbl3FROM C tableSELECT DINTO #TmpTbl4FROM D tableSELECT *FROM A TableJOIN B TableON B = AJOIN C TableON C = AJOIN D TableON D = ADrop table #TmpTbl1Drop table #TmpTbl2Drop table #TmpTbl3Drop table #TmpTbl4If I stop the execution in between, I have to highlight each Drop table #TmpTbl1 and #TmpTbl2 and #TmpTbl3 or #TmpTbl4 to re run the query. What is the better way to handle (create temp table) this so I don't have to execute each Drop Table #TmpTbl if I stop the query execution and re run it again?Thank you allSQLBoy |
|
stepson
Aged Yak Warrior
545 Posts |
Posted - 2014-09-24 : 00:58:48
|
[code]IF OBJECT_ID('tempDB.dbo.#TmpTbl1') IS NULLBEGIN SELECT A INTO #TmpTbl1 FROM A tableEND[/code]sabinWeb MCP |
|
|
|
|
|