1。EXEC可用全局临时表
exec('select (''''''''+ Uname) as Uname into ##t from user_info)
if object_id('tempdb..##t') is not null
print '1'
2。EXEC用临时表时,要注意:
exec('select (''''''''+ Uname) as Uname into #t from user_info;waitfor delay ''00:00:10''')
用waitfor delay,这时在10秒内可查到临时表的存在。
exec('select (''''''''+ Uname) as Uname into ##t from user_info)
if object_id('tempdb..##t') is not null
print '1'
2。EXEC用临时表时,要注意:
exec('select (''''''''+ Uname) as Uname into #t from user_info;waitfor delay ''00:00:10''')
用waitfor delay,这时在10秒内可查到临时表的存在。