We are using sybase data base . Here we have database called yearly_history. This data base contains 100s of tables and each table its having data from 2003. we need to delete 3 yrs of data.
In each table we have field called yearmonth. This will be 200303,200306,200309,200312,200403,200406,200409,2 00412 etc..upto 200903.. we need to delete the data if year month is upto 200603.
I have sample script to delete the record for onemonth..we need to delete the record for atleast 3yrs..pls guide me.
#!/bin/ksh
LOGFILE=$CLOGS/user_record_del_200306.log
uid=operator
srv=phxeslo
pwd=`cat $SYBASE/.operatorpwd`
echo "Started at: "`date` >>$LOGFILE
isql -U$uid -S$srv << EOF >>$LOGFILE
$pwd
use yearly_history
go
print "Started deleting user_record table for the year 200306 "
go
delete user_record where yearmonth=200306
go
EOF
echo "Finished deleting user_record for the year 200306 " >>$LOGFILE
echo "---------------------------------------------------" >>$LOGFILE
date >>$LOGFILE
echo >>$LOGFILE