Sunday 26 February 2012

How to setup a task to delete the old backup files or log files from the server ?

Cleaning up the servers disks on daily basis is very important task for smooth functioning of servers.We have seen many times our report servers went down  and database backup failed due to the lack of disk space.
It is a tedious task to log in to the servers and delete the old files manually on regular basis. It will be more tedious if you need to manage more servers.The below VB script will help you to schedule the clean up job using a Windows Task Scheduler.


This VB script will help to remove files from the folders which is older than the retention days mentioned in the function call.Now this can be scheduled to run on specified schedule using windows task manager. The account in which this task is scheduled should have full security right on the folders to perform this task. The VB script file is downloadable at

Hope this will help you to save lot of time!

How to remove new line character from string using SQL ?

In a varchar column some of the entries were showing space in the left side and even after using the LTRIM it was not getting removed. When I tried to  print the first character using the ASCI function it was showing 13 which is a new line character. it can be replaced by using the below code