Is there a way that I can get the number of disk IOs from a transaction into a sql variable.
Currently I can do this in management studio.
set statistics io on
select ..........
And I get results like.
(39 row(s) affected)
Table 'xxx'. Scan count 1, logical reads 126, physical reads 2, read-ahead reads 0,
lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
I want to be able to do something like select @myios = @@IO_COUNT
Or something like this. I want to programmatically insert stats into a custom table for my application for review later in a user friendly way.