Thursday, February 27, 2014

I love where I work!

I love where I work and the work I do. One of my co-workers penned a great article about the company we work for, Twin Technologies.  Read the following article and send over your resumes to get started!

Friday, January 31, 2014

Shrink LDF Files

The following script is what we used to shrink all of our sql server database log files:

-- database name
declare @name varchar(100)
-- path for backup files
declare @sql varchar(max)
set @sql = ''

declare db_cursor cursor for  

select [name]
from sys.databases
where database_id > 4 and state = 0
order by name 

open db_cursor
fetch next from db_cursor into @name
while @@fetch_status = 0
       set @sql = 'use' +''+ '[' + @name + ']' + ';' + '' + 'dbcc shrinkfile(2,1)'
     --print @sql
       exec (@sql)
       fetch next from db_cursor into @name
close db_cursor
deallocate db_cursor