임시테이블을 사용하고 난 후에
예외처리부분에서 사용하면 유용하다.


-- OBJECT_ID() 확인후 있으면 테이블 삭제
IF OBJECT_ID('tempdb..#tblTemp') IS NOT NULL
    drop table #tblTemp


-- 확인
Select table_catalog, table_schema, table_name, table_type
from tempdb.information_schema.tables
where table_name like '#temptable%'

-- tempdb.sys.objects
select *
from tempdb.sys.objects
where name like '#aaa%'

+ Recent posts