How do you access an SQL database in WinCC Runtime Advanced using a script?
SQL databases are accessed in WinCC Runtime Advanced by means of scripts, except when archiving tags or messages.
To access an SQL database, it must have been created in the SQL server.
The WinCC Runtime Advanced functions as an SQL client.
An SQL database cannot be accessed from a Windows CE-based panel (a Comfort Panel, for example).
- SQL server1), Microsoft SQL Server 2014, for example
- SQL data source has been created
- WinCC Advanced ES or WinCC Professional ES
- WinCC Runtime Advanced V14 or higher
1) The SQL server used must also be released for the operating systems (that are also released for WinCC Runtime Advanced).
How to create a Microsoft SQL database is described in Entry ID: 61886098.
Documentation (1.1 MB)
The documentation covers the following topics.
- SQL database
- Create a database
- Delete a database
- Create a table
- Copy a table
- Delete a table
- Read data records from a table
- Write data records to a table
- Edit data records in a table
- Delete data records in a table
- Read all the data records from a table
This download contains the sample project, which includes all the examples/topics listed, including the relevant scripts.
Runnability and test environment
Below is a list of the components that have been used to create this entry and verify the functions described.
- PC operating system: Microsoft Windows 7 SP1
- HMI software: WinCC Advanced V14
- Operating and monitoring system: WinCC Advanced Runtime V14
Databases, Database access, Structured Query Language, SQL, Archiving, Archive