簡體   English   中英

SQL Server-如何計算數據庫中每個表的某些行的大小?

[英]Sql Server - How to calculate the size of some rows from each table in a database?

如何計算每個表的某些行的大小?

例如,使用代碼:

EXEC sp_spaceused 'myTable'

您獲得了所有行的大小,但是我想計算的不是一個表的大小,而是所有表的大小,並對每個表使用相同的子句,在偽代碼中是這樣的:

foreach(Table myTable in Database)
  EXEC sp_spaceused 'myTable WHERE AppId='abc''

如何使用T-SQL做到這一點?

提前致謝

編輯:為了更好的說明

-- Plop the data into a temp table
Select myFields into #tmpdata from myTable where myCondition = 'foo'

use tempdb
GO
exec sp_spaceused #tmpdata

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM