
# SQL selecting all jobid in pool "Full"
# which is a terminated backup (T,W)
# and was never copied or migrated (PriorJobid 0).

Job {
    Name = "<name>"
    JobDefs = "DefaultJob"
    Type = Migrate
    Pool = Full
    Selection Type = SQL Query
    # Multiple lines instructions is available since version 21.0.0
    Selection Pattern = "WITH pids AS
            ( SELECT poolid FROM pool WHERE name = 'Full' )
            SELECT jobid FROM job j, pids p
            WHERE j.poolid=p.poolid
            AND type='B'
            AND jobstatus IN ('T','W')
            AND priorjobid = 0;"
}
