2

sp_spaceused, when executed without any parameters, produces 2 result sets

database_name, database_size, unallocated_size  
reserved, data, index_space, unused

Usually when you execute some SP, you can insert output into temp table like below example:

insert #temp (column1, column2, column3)
exec sp_someprocedure

but in case of sp_spaceused (without any parameters) - can not insert output, since it produces 2 result sets. I know 2016 has nice parameter @oneresultset = 1, but is there any way you can insert 2 or more output result sets into #temp in SQL 2014 or lower ?

Is there any tricks ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.