Hi guys,
How can I solve this problem? I need to write a Dynamic SQL with Temp Table but when I try to execute the command, it gives me an "Invalid Object". Please help me.
Declare @SQL char(2000)
Set @SQL='Select top 10 * into #report from myTable'
exec (@sql)
Select * from #report
(10 row(s) affected)
Server: Msg 208, Level 16, State 1, Line 1
Invalid object name '#report'.
Thanks.