MSSQL

Get MS_Description from all tables AND columns in a database. Suh-weet. SELECT u.name + ‘.’ + t.name AS [table], td.value AS [table_desc], c.name AS [column], cd.value AS [column_desc] FROM sysobjects t INNER JOIN sysusers u ON u.uid = t.uid LEFT OUTER JOIN sys.extended_properties td ON td.major_id = t.id AND td.minor_id = 0 AND td.name =…

Read More Get ALL table and column descriptions in MSSQL

tsql so I can remember in the future. declare @db_id int declare @object_id int set @db_id = DB_ID(‘EMR’) set @object_id = 0 select  db_name(@db_id) as [database], object_id, object_name(object_id, @db_id) as object_name, index_id, avg_fragmentation_in_percent, page_count from sys.dm_db_index_physical_stats(@db_id, null, null, null, ‘LIMITED’) where page_count > 1000 and avg_fragmentation_in_percent > 35 order by avg_fragmentation_in_percent desc database object_id object_name…

Read More Check Fragmentation on Objects in SQL Database