Go Back   Tech Support Forum > Design Forum > Web Serving and Management

User Tag List

Cron to copy SQL Table then clear

This is a discussion on Cron to copy SQL Table then clear within the Web Serving and Management forums, part of the Tech Support Forum category. Hi All, I know how to do this manually by performing the following command once I select the database: insert


Closed Thread
 
Thread Tools Search this Thread
Old 07-09-2018, 12:57 AM   #1
Elite Commander
 
VividProfessional's Avatar
 
Join Date: Apr 2009
Location: Merseyside Uk
Posts: 1,406
OS: Windows 10

My System

Send a message via MSN to VividProfessional

Hi All,
I know how to do this manually by performing the following command once I select the database:

insert log select * from adsb_aircraft;
delete from adsb_aircraft;

The database is called aircraft.

I need to ensure the id keeps incrementing hence the delete and not truncate.

sample data is -

+-----+--------+---------------------+---------------------+
| id | icao | firstSeen | lastSeen |
+-----+--------+---------------------+---------------------+
| 1 | 4ca1c2 | 2018-07-06 19:34:08 | 2018-07-08 22:26:16 |
| 2 | 406099 | 2018-07-06 19:34:23 | 2018-07-06 19:40:04 |
| 3 | 406605 | 2018-07-06 19:34:38 | 2018-07-08 19:15:32 |
| 4 | 40610f | 2018-07-06 19:35:38 | 2018-07-08 10:02:13 |
| 5 | 4006ee | 2018-07-06 19:35:54 | 2018-07-06 19:43:05 |
| 6 | 4d21a7 | 2018-07-06 19:37:09 | 2018-07-08 15:43:27 |
| 7 | 406d98 | 2018-07-06 19:38:56 | 2018-07-08 20:21:48 |
| 8 | 4ca80b | 2018-07-06 19:40:49 | 2018-07-06 19:48:07 |
| 9 | 40710e | 2018-07-06 19:42:20 | 2018-07-08 19:49:00 |
| 10 | 4069ea | 2018-07-06 19:44:21 | 2018-07-06 19:51:39 |


So basically I need to run the following command under a cron job at 00.01 each night:

insert log select * from adsb_aircraft;

and then at 00.02
delete from adsb_aircraft;

I wouldn't be expecting more than 1,000 rows per day so low volume.
__________________
Boeing 787 Dreamliner Register
The worlds premier Dreamliner site
www.b787register.co.uk
VividProfessional is offline  
Sponsored Links
Advertisement
 
Old 07-09-2018, 08:49 AM   #2
Elite Commander
 
VividProfessional's Avatar
 
Join Date: Apr 2009
Location: Merseyside Uk
Posts: 1,406
OS: Windows 10

My System

Send a message via MSN to VividProfessional

now sorted this - was overlooking and over engineering this!
__________________
Boeing 787 Dreamliner Register
The worlds premier Dreamliner site
www.b787register.co.uk
VividProfessional is offline  
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Similar Threads
Thread Thread Starter Forum Replies Last Post
Run SQL from VBScript
Hello I have a batch file that works great, but I am wanting to turn it into a VBS script(which I am not familiar with yet) and ultimately turn it into an HTA graphical interface. My main concern is I have no idea how to go about running SQL commands from VBS. I will post my batch script so you...
justinds89 Web Design & Development 0 11-02-2012 06:54 AM
Internet Explorer Loads & Uses Tons of Memory
Internet Explorer runs on it's own--in the background--and uses tons of memory. This is similar to a problem that a user named MalusCalibur had back in 2008. IE loads up and runs from 30K and climbs to anywhere from 100-300K of Memory. I've quelled this problem by constantly having Windows...
Deeke777 Virus/Trojan/Spyware Help 35 06-26-2012 01:11 PM
Trojan/Spyware infected! [Antimalware Doctor] Please help!
Hello, I got a dell inspiron laptop that is infected with spyware, and hopefully someone can help me fix this. The problem is I got a fake spyware software installed on my machine, and it's called Antimalware Doctor. It will pop up a window and prompt me to remove spyware that it detected. ...
goukoy Resolved HJT Threads 8 07-07-2011 08:14 AM
Access 2003 Create table in sql view
How do I create a new table in sql view in access 2003?
vicstate Microsoft Office support 1 05-04-2011 06:18 AM

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is on
Smilies are on
[IMG] code is on
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Post a Question


» Site Navigation
 > FAQ
  > 10.0.0.2
Powered by vBadvanced CMPS v3.2.3


All times are GMT -7. The time now is 02:26 AM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
vBulletin Security provided by vBSecurity v2.2.2 (Pro) - vBulletin Mods & Addons Copyright © 2020 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.1.0 (Pro) - vBulletin Mods & Addons Copyright © 2020 DragonByte Technologies Ltd.
Copyright 2001 - 2018, Tech Support Forum

Windows 10 - Windows 7 - Windows XP - Windows Vista - Trojan Removal - Spyware Removal - Virus Removal - Networking - Security - Top Web Hosts