Here you go.
@ECHO OFF
REM -- move to the source directory --
G:
cd \MSSQL\Backup\BakFileDir
REM -- Compress the files --
FORFILES /S /M *.bak /C "cmd /c C:\PROGRA~1\WinRAR\rar m -m3 @file.rar"
REM -- copy all the files recursively with XCOPY
XCOPY *.rar G:\MSSQL\Backup\BakFiles_compressed\ /S /RC /Y
REM -- Delete the rar file in the source folder --
FORFILES /S /M *.rar /C "cmd /c del @file"
REM -- delete rar files in target dir more than 1 day old --
CD \MSSQL\Backup\BakFiles_compressed\
FORFILES /S /D -1 /M G:\MSSQL\Backup\BakFiles_compressed\*.rar /C "cmd /c del @file"
Saturday, March 10, 2012
Compress, move and delete old .BAK files using WinRar
Posted by
Greg
at
3/10/2012 01:43:00 AM
0
comments
Tuesday, January 31, 2012
How to Get Back Into SQL 2005 When Locked Out
Sometimes it's just good to see it done live, as it were.
How to Recover From Being Locked Out of a SQL Server 2005 database
This is SQLShare.com, so you have to be logged in to see the video, but it's free.
---
Posted by
Greg
at
1/31/2012 11:36:00 AM
0
comments
Saturday, January 07, 2012
Saturday, December 31, 2011
Do you suck at "PowersPointless?"
Frankly, everyone who works in tech should see these slides.
Posted by
Greg
at
12/31/2011 04:06:00 PM
0
comments
Saturday, December 24, 2011
SQL Down Under #48 with Roger Doherty
I listen to SQL Down Under whenever I can and this one was a particularly good show. All, or most of the stuff that's new in SQL Server 2012 is covered.
Check it out.
| Show | Guest | Date | Description | MP3 | WMA | Transcript | |
| 48 | ![]() | Roger Doherty | 21Dec11 | SDU Show 48 features SQL Server program manager Roger Doherty introducing SQL Server 2012. | MP3 | WMA |
Posted by
Greg
at
12/24/2011 04:03:00 PM
0
comments
SQL Saturday Houston -- April 21rst
So I am passing this on, as requested. If you are in Houston that weekend, you should attend. I did last year and it was GREAT!.
--------------------------------------------

| SQLSaturday#107is coming up on Apr 21, 2012 and we need your help to get the word out! Email or instant message your friends, post it on your blog, tweet it on Twitter - free training is coming soon for those interested in SQL Server!Seriously, let your colleagues know that SQLSaturday is coming up on Apr 21, 2012 at YES Prep Public Schools - North Central Campus, 13703 Aldine-Westfield, Houston, TX, 77039 and we still have seats left. As we get closer to the event we'll have more information on the event logistics, but for now you can just savor the wait:-) For more information please visit SQLSaturday.com or email us at sqlsaturday107@sqlsaturday.com Thanks! Team SQLSaturday |
Posted by
Greg
at
12/24/2011 03:58:00 PM
0
comments
Thursday, November 17, 2011
Quick View of All Users in All Databases
Run it in Text Mode in SSMS (CTRL+T)
/**********************************************************************
OBJECT/SCRIPT NAME: Get All Users in All DBs.sql
PURPOSE: Get all the users not sys user for all DBs not sys DBs.
Change History: 11/17/2011 2:26 PM - gmilner: Created
**********************************************************************/
EXEC sp_MSforeachdb '
Use [?];
IF DB_NAME() NOT IN (''master'',''model'',''msdb'',''tempdb'')
select
cast(DB_NAME() as NVARCHAR(62)) as DatabaseName,
cast(name as NVARCHAR(62)) as DBUserName,
createdate,
isntgroup, isntname, isntuser,
issqluser, islogin, issqlrole
from sysusers
where islogin = 1
and name not in (''dbo'',
''guest'',
''INFORMATION_SCHEMA'',
''sys'')
AND DB_NAME() NOT IN (''master'',''model'',''msdb'',''tempdb'')
ORDER BY isntuser DESC, isntname DESC, name
'
Posted by
Greg
at
11/17/2011 03:04:00 PM
0
comments

