Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin.
Search for scripts directly from SSMS, and instantly access any saved scripts in your
SSC briefcase from the favorites tab.
Download now (direct download link)
Thank this author by sharing:
This can be run as a job or manually. There are no parameters so it will do ALL log files that it finds; excluding system files.
If you want to shrink all database files including data files (and indexes) then find these lines of code:
SELECT @exec_stmt = 'INSERT INTO #logfiles SELECT ''' + @DBName + ''' , name FROM ' + quotename(@DBName, N'[') + N'.dbo.sysfiles WHERE groupid = 0'and replace it with this code:
SELECT @exec_stmt = 'INSERT INTO #logfiles SELECT ''' + @DBName + ''' , name FROM ' + quotename(@DBName, N'[') +N'.dbo.sysfiles'
Concatentaion of @dbname from cursor + table name to use in FROM clause
Alter Database DBNAME Set Recovery Full. Gives error.
query to get dbname,totalsize,reservedsize of all databases in sql 2000