require(RODBC) sqlDropLast<-function(conn, tablename, droplast=1){ table<-sqlFetch(conn, tablename) table<-table[1:(nrow(table)-droplast),] sqlSave(conn, table, tablename = tablename, safer = F)}