add sql for archive