Reputation: 2533
How can i calculate the size of only some rows for each table?
For example, with the code:
EXEC sp_spaceused 'myTable'
you obtain the size of all rows, however i want to calculate the size not of one single table, but all of them, and using the same clause for each one, something like this in pseudo-code:
foreach(Table myTable in Database)
EXEC sp_spaceused 'myTable WHERE AppId='abc''
How can i achieve this with T-SQL?
Thanks in advance
EDIT: for better clarification
Upvotes: 0
Views: 1371
Reputation: 181
-- Plop the data into a temp table
Select myFields into #tmpdata from myTable where myCondition = 'foo'
use tempdb
GO
exec sp_spaceused #tmpdata
Upvotes: 4