# HG changeset patch # User Oleksandr Gavenko # Date 1674401247 -7200 # Node ID 11f741239f16b32d6246a46a6e7c80bf9d8fb113 # Parent 32fc3dd882bb16f253989eb3a5c6e7dac7699852 Table stats. diff -r 32fc3dd882bb -r 11f741239f16 sqlserver.rst --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sqlserver.rst Sun Jan 22 17:27:27 2023 +0200 @@ -0,0 +1,36 @@ + +============ + SQL Server +============ +.. contents:: + :local: + +Informational schema +==================== + +:: + + SELECT * FROM sys.tables; + SELECT * FROM sys.views; + SELECT * FROM sys.indexes; + + SELECT * FROM information_schema.tables; + +Table stats +=========== + +Individual table:: + + EXEC sp_spaceused NAME; + +All tables in a schema:: + + sp_msforeachtable 'EXEC sp_spaceused [?]'; + +List collations +=============== + +:: + + SELECT name, description FROM sys.fn_helpcollations(); +