1

Actually, I am working on the connection between S7 1500 PLC and SQL server I can send and receive data successfully. I build a table in the SQL server(product ID, product, quantity, product Key).

many products can have the same Product Key.

I need a command in the PLC Like

Insert
FROM TestTable
WHERE product Key=5000'

that gives me all the products with a product key=5000

Thom A
  • 88,727
  • 11
  • 45
  • 75
  • Do you simply want `INSERT INTO newtable SELECT * FROM TestTable WHERE product Key=5000`? – jarlh Jul 01 '21 at 08:24
  • 2
    I've removed both of the tags [[tag:mysql]] and [[tag:sql-server]] as this is clearly neither of them; it isn't valid syntax for either RDBMS' dialect. Also you appear to have forgotten to ask a question. – Thom A Jul 01 '21 at 08:24

2 Answers2

0

I did answer a similar question

Where should I start with my OPC-UA client?

If you are just looking to move data from a PLC to a database then take a look at Node-Red. Here is a video that should help you get started. Node-Red can talk direct to the PLC. If you need more help just ask!!

https://www.youtube.com/watch?v=LaUmhhMdoyY

Node-Red can also do the GUI.

For the reporting you can use https://grafana.com/.

If you would like a good Database to log to look at https://www.timescale.com/.

Grafana and Timescale work well together!!

CTGControls
  • 104
  • 1
  • 8
  • I have received data from the database in the PLC. I use Wireshark to see if it's true I find that is true but the problem that I can't read those results on the PLC example:500 in the database it becomes 16#F401_C100 something like that it's don't make sense – Fares JEMAI Jul 02 '21 at 12:08
  • You would need to build a full interpreter for the PLC. I can not say it can not be done, I can just say it should not be done without adding some type of mediator software. I use node-red for this. You can pass the SQL commend to node-red. Node-red would then excite the SQL and can fill a string in the PLC with the results. – CTGControls Jul 03 '21 at 03:09
0

As far as i understand your Question, you should try this Querie:

SELECT products From TestTAble WHERE Key = 5000

How is your Database Design? Can you share more information about your Database and Table?