Tuesday, February 28, 2012

How to get cleanup old sql backup files

If you want to keep last 7 days sql backups files only there here you go

declare @cDate varchar(20)
select  @cdate =   LEFT( CONVERT(nvarchar(30), (GETDATE()-7), 126),10) -- make sure -7 days
--print @cDate
execute master.dbo.xp_delete_file 0,N'\\mssql\backups\',N'bak',@cdate

Saturday, February 25, 2012

How to migrate SSIS packages from SQL Server 2005 to 2008

In SQL Server 2005 by default SQL Native Client will be installed

1. First Make sure to install SQL Native Client on SQL Server 2008.
2. Using (BI) SSIS Package Upgrade Wizard on SQL Server 2008 to upgrade the SSIS packages.

SQL Server Native client 10.0 will be automatically isntalled when you install sql server.
Once you upgrade the SSIS packages you can easily change to SQL Server Native client 10.0