Write SQL Tabke

Hi, I need writing values that I’m reading online “PLC” to SQL table.
Every time my table was modified, I have debouts correct scripts for this function.

Tables= Pressure Process
Column1= PS1
Column2= PS2


You should use a transaction group to write values from the PLC to the database. You can use the standard group setting the mode from OPC->DB. You just need to map each PLC tag to a column in the database table. If you want bi-directional synchronization you can set the mode to Bi-Directional OPC Wins.


Are you using FactorySQL or Ignition? If Ignition, are you using the SQL Bridge module? If so, or if FactorySQL, you just need to add the two items to a standard group (or a historical group), and then on the trigger panel select “Async Trigger” or “Only evaluate when values have changed” option (the names are a little different between the two programs).

If you’re using Ignition and want to do it in scripting, I would just create a gateway tag change script that listens to the tags you want, and then use the [tt]system.tag.read()[/tt] and [tt]system.db.runPrepQuery()[/tt] functions. The documenation for read() has an example of using both of them together.

Hope this helps,