I create a temp table in order to get the result of dbcc tracestatus() in that table. Then I want to select its name field. This is my code, which gives an error
Incorrect syntax near the keyword 'dbcc'.
create table #tb1 ([name] int, [status] int, [global] int, [session] int)
insert into #tb1 exec(dbcc tracestatus())
select [name] from #tb1
But I can't correct the syntax error that I get. Can someone point out?
* If it is possible to directly select the name field from dbcc tracestatus() then please show how.
Thanks for your time.