-2

Will you please provide a single query in SQL Server to fetch audit information of databases and tables in the server as below?

Database audit should include record count for each table, table size, database size and drive size in the server including Server name.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • sorry, but we can't. it's secret knownledge preserved only for community members and readers of [how-to-ask](https://stackoverflow.com/help/how-to-ask) – Maciej S. Mar 22 '19 at 08:52
  • https://dba.stackexchange.com/questions/81245/how-to-determine-the-size-of-my-tables-in-the-sql-server-database – Suraj Kumar Mar 22 '19 at 08:53
  • https://stackoverflow.com/questions/7892334/get-size-of-all-tables-in-database – Suraj Kumar Mar 22 '19 at 08:56

1 Answers1

0

You can try this

For single table pass the table name as shown below.

exec  sp_spaceused N'dbo.MyTable'

For all tables use the below query.

exec sp_MSForEachTable 'exec sp_spaceused [?]'
Suraj Kumar
  • 5,547
  • 8
  • 20
  • 42