Use the "WITH TABLERESULTS" option.
DBCC CHECKDB WITH TABLERESULTS
>Hi there.
>
>I'm having trouble figuring out how to get the results/messages back from a sql passthrough call that does a DBCC on the SQL server. When I run the lcCmd shown below, it executes successfully, but the DBCC_Res cursor is not generated. (which I kinda' figured it might not be)
>
>
>lcCmd = [DBCC CHECKDB ('TestDB')]
>lnResult = sqlexec(lnHandle, lcCmd, 'DBCC_Res')
>
>So, is there an @@ variable I can retrieve on the very next sql call or something???
>
>TIA, Scott :-D