August 23, 2018 at 4:34 am
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.
August 23, 2018 at 4:52 am
here quotes should be addedcreate table #tb1 ([name] int, [status] int, [global] int, [session] int)
insert into #tb1 exec('dbcc tracestatus()')
select [name] from #tb1
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy