Friday, January 30, 2009

SQL Server: how to get the sizes of the columns of a table

select C.name, C.max_length from sys.columns C
inner join
sys.tables T
on C.object_id = T.object_id and T.name = '<table name>'

SQL Server: how to see Log Transaction status

select name, log_reuse_wait, log_reuse_wait_desc from sys.databases

SQL Server: how to get the sizes of all tables

EXEC sp_MSforeachtable @command1="EXEC sp_spaceused '?'"