0
Under review

is it possible to run SQL command on irpro server start?

Tanapol E. 5 jaar geleden in Tips and Tricks bijgewerkt door Vladimir Ovchinnikov (expert) 5 jaar geleden 7

is it possible to run SQL command on irpro server start?

I would like to run 

"DELETE FROM `FLOAT_TAG_HISTORY` WHERE `VALUE` = 0.00" 

and

"DELETE FROM `INTEGER_TAG_HISTORY` WHERE `VALUE` = 0"

to clear out zero value in IR Main database

Under review

Hello.

Do you want to query the system database? We strongly recommend that you do not remove something from the system database script from the server project. You have the right to do with your database whatever you see fit, but in case of wrong actions, you risk to bring iRidium server inoperable.

Hi, 

Yes i want to clear zero value on some tag in tag history

Because it writes down zero value when server was restart

We understand, do it at your own risk. If the database is damaged and you do not have a backup, the iRidium server will not be able to start. In this case, stop the iRidium server, delete the broken database and start again. The database will be created again automatically, with empty values.

Ok, 

I will take a risk

But which command i should use for open system database? 

DELETE FROM table_name WHERE VALUE = 0;

Hi

I mean JS command like this

mybase = new SQL();
   mybase.Open('WHICH FILE SHOULD I oPEN HERE', true);

var systembase = IR.GetDatabase();

var result = systembase.Request('DELETE FROM INTEGER_TAG_HISTORY WHERE VALUE = 0;');

//The system database is read-only. Therefore, this code may not work in future releases.