mssql truncate all log files

Learn in MSSQL how to truncate all log files! This transact-sql statement uses the core truncation method recommended by Microsoft.mssql truncate all log files

mssql truncate all log files on a MSSQL 2000, 2005 server DECLARE @db varchar(255) declare @sql varchar(200) DECLARE curName CURSOR LOCAL FAST_FORWARD FOR select name from master.dbo.sysdatabases where dbid > . . . → Read More: mssql truncate all log files

SQL Server: How to add an identity column to a table with data.

This post thanks to the caveman blog! All hail the caveman blog!

http://cavemansblog.wordpress.com/2009/04/02/sql-how-to-add-an-identity-column-to-a-table-with-data/

This article demonstrates a step-by step procedure about how an identity column an be added to a table that has data. There are two ways of adding an identity column to a table with existing data:

1. Create a new table . . . → Read More: SQL Server: How to add an identity column to a table with data.

Howto: check database fragmentation sql server

Howto: check database fragmentation sql server

How to find all indexes that have fragmentation over 25%:

select * FROM sys.dm_db_index_physical_stats (NULL, NULL, NULL , NULL, ‘LIMITED’) WHERE avg_fragmentation_in_percent > 25.0 AND index_id > 0 AND page_count > 1000 order by avg_fragmentation_in_percent desc

Howto: Fix an oversized modellog.ldf

modellog.ldf too big?

First try to figure out what’s using the log file:

use [model] select (sum(size) * (8192/1024)) / 1024 from dbo.sysfiles WHERE (status & 0×40) 0 DBCC SQLPERF(LOGSPACE) select ceiling((sum(size) * (8192.0/1024.0)) / 1024.0) from dbo.sysfiles exec sp_spaceused DBCC SQLPERF(LOGSPACE)

It is very unusual that the model database data or log files would . . . → Read More: Howto: Fix an oversized modellog.ldf