Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2009
    Posts
    13

    Unanswered: how to delete the record field for multiple table in same database

    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

  2. #2
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    Talking Less or equal?

    Did you try:
    Code:
    delete user_record where yearmonth<=200603
    go
    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •