cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

in Thingworx How to archive data table everyday since two years?

Islam_Amer
10-Marble

in Thingworx How to archive data table everyday since two years?

I have created table1 for daily direction in "Mysql workbench 6.3 CE" with 11 Rows , I want to archive all data table in another table archive every day since 2 years to have all history. How can I write such a table?

This the table script:

CREATE TABLE ``table1(
IDINT(11) NOT NULL,
tskVARCHAR(200) NULL DEFAULT NULL,
labelVARCHAR(45) NULL DEFAULT NULL,
statVARCHAR(10) NULL DEFAULT NULL,
noteVARCHAR(200) NULL DEFAULT NULL,
dateVARCHAR(45) NULL DEFAULT NULL,
recVARCHAR(45) NULL DEFAULT NULL,
  PRIMARY KEY (ID),
  UNIQUE INDEXID_UNIQUE(ID` ASC));
ACCEPTED SOLUTION

Accepted Solutions

Hello Everyone,

 

we use coding 

- API to set all table status by default Open 

- set API Loop all Rows if User change status from Open to any other word it will move the row in to another table

 

 

View solution in original post

4 REPLIES 4
CRArko
17-Peridot
(To:Islam_Amer)

Hello.

 

I gather you are using MySQL for your persistent storage?

 

Have you tried something like this?

 

Disclaimer: this comes from a 3rd-party MySQL support area, and not from PTC. Use at your own risk and on a test system before trying it in production.

 

Suppose you have mydb.mytb and you want to create mydb.mytbcopy

In the mysql client, run the following

USE mydb
CREATE TABLE mytbcopy LIKE mytb;
INSERT INTO mytbcopy SELECT * FROM mytb;

 

Thanks,

 

-- Craig A.

 

 

Hello Craig ,

Thanks for Reply

 

I gather you are using MySQL for your persistent storage? Yes , i use MySql Workbench 6.3 CE

 

in attached pic from the DB where i supposed to write this code ?

 

 

 

 

 

CRArko
17-Peridot
(To:Islam_Amer)

Hello.

 

Based on the picture you attached and your earlier post, it looks like your earlier CREATE statement should be used to create the backup (copy-to) table and then the SELECT statement that's in your screen grab would be included inside the INSERT INTO statement.

 

Thanks,

 

-- Craig A.

Hello Everyone,

 

we use coding 

- API to set all table status by default Open 

- set API Loop all Rows if User change status from Open to any other word it will move the row in to another table

 

 

Announcements


Top Tags