 ===================================================================
 --- src/cats/sql_update.c	(revision 8456)
 +++ src/cats/sql_update.c	(working copy)
-@@ -137,11 +137,11 @@
+@@ -136,13 +136,7 @@
+    utime_t now = (utime_t)time(NULL);
     edit_uint64(now - age, ed1);
  
-    Mmsg(mdb->cmd,
+-   Mmsg(mdb->cmd,
 -        "INSERT INTO JobHistory " 
-+        "INSERT INTO JobHisto " 
-          "SELECT * " 
-           "FROM Job "
-          "WHERE JobStatus IN ('T', 'f', 'A', 'E') "
+-         "SELECT * " 
+-          "FROM Job "
+-         "WHERE JobStatus IN ('T', 'f', 'A', 'E') "
 -           "AND JobId NOT IN (SELECT JobId FROM JobHistory) "
-+           "AND JobId NOT IN (SELECT JobId FROM JobHisto) "
-            "AND JobTDate < %s ", ed1);
+-           "AND JobTDate < %s ", ed1);
++   Mmsg(mdb->cmd, fill_jobhisto, ed1);
     QUERY_DB(jcr, mdb, mdb->cmd); /* TODO: get a message ? */
     return sql_affected_rows(mdb);
-@@ -161,7 +161,7 @@
+ }
+@@ -161,7 +155,7 @@
     time_t ttime;
     struct tm tm;
     int stat;

 
 CREATE TABLE Location (
    LocationId INTEGER,
@@ -183,6 +183,7 @@
    VolStatus VARCHAR(20) NOT NULL,
    Enabled TINYINT DEFAULT 1,
    Recycle TINYINT DEFAULT 0,

    PoolType VARCHAR(20) NOT NULL,
    LabelType TINYINT DEFAULT 0,
    LabelFormat VARCHAR(128) NOT NULL,
@@ -383,7 +386,7 @@
 
 
 -- Initialize Version		 
