filmov
tv
Get size of tables in SQL Server / #SQLTutorials

Показать описание
To get a rough view of how many rows, total, used and unused space each table has, in a SQL Server database you can run the following query:
--// Display disk space information about a table
USE {database_name};
GO
EXEC sp_spaceused N'{dbo}.{table_name}';
GO
--// Display disk space information for all tables at once
USE {database_name};
GO
sp_msforeachtable N'EXEC sp_spaceused [?]';
GO
🔹 Tag: SQL,
🔹 2005 © Kenium. All rights reserved. Do not re-up!
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
📌 Could you please buy me a ☕ coffee ☕ via:
👉 Bitcoin: 3DgQiM8JZQ8RhtKqBP5WyaxKmqSpSjpLtu
👉 Etherum: 0x4D6048E542eB62368eFF3d07df7D3e58448e1417
👉 Tether USDT: 0x51e366ca82bb02d735659c3f72b9426a6c969357
📌 Thank you so much!
--// Display disk space information about a table
USE {database_name};
GO
EXEC sp_spaceused N'{dbo}.{table_name}';
GO
--// Display disk space information for all tables at once
USE {database_name};
GO
sp_msforeachtable N'EXEC sp_spaceused [?]';
GO
🔹 Tag: SQL,
🔹 2005 © Kenium. All rights reserved. Do not re-up!
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
📌 Could you please buy me a ☕ coffee ☕ via:
👉 Bitcoin: 3DgQiM8JZQ8RhtKqBP5WyaxKmqSpSjpLtu
👉 Etherum: 0x4D6048E542eB62368eFF3d07df7D3e58448e1417
👉 Tether USDT: 0x51e366ca82bb02d735659c3f72b9426a6c969357
📌 Thank you so much!