Create your free account or log in to subscribe to the forum - and gain access to more than 10,000+ support articles along with insights from experts and peers.
Already have an account? Login
It's your place to connect with experts and peers, get continuous support, and share knowledge.
This forum is addressing industrial automation design & engineering, operations, asset performance, cyber security and digital transformation for Plants & Machines.
You can subscribe to this forum after you log in or create your free account..
Create your free account or log in to subscribe to the forum - and gain access to more than 10,000+ support articles along with insights from experts and peers.
Already have an account? Login
Posted: 2021-04-08 11:15 AM . Last Modified: 2021-04-08 11:29 AM
Hell Jesper,
You can use {} to enclose tags in a DBExecute script command.
For example:
SELECT * FROM {MyTag}.trend001
However, you want to change the database?
You can change the database/ERP reference in the DB Execute.
$DBExecute($MyDBConnection, "SELECT * FROM trend001")
Where $MyDBConnection is a string which contains the of the Database/ERP connection name that you created.
@jthyge wrote:
Hello
How is it possible to use tags in SQL statements in Machine SCADA Expert?
If I e.g. want to change the database the select is made in.
SELECT * FROM [TAG].trend001
Best regards
Jesper
Posted: 2021-04-08 11:15 AM . Last Modified: 2021-04-08 11:29 AM
Hell Jesper,
You can use {} to enclose tags in a DBExecute script command.
For example:
SELECT * FROM {MyTag}.trend001
However, you want to change the database?
You can change the database/ERP reference in the DB Execute.
$DBExecute($MyDBConnection, "SELECT * FROM trend001")
Where $MyDBConnection is a string which contains the of the Database/ERP connection name that you created.
@jthyge wrote:
Hello
How is it possible to use tags in SQL statements in Machine SCADA Expert?
If I e.g. want to change the database the select is made in.
SELECT * FROM [TAG].trend001
Best regards
Jesper
Posted: 2021-04-08 11:42 AM
HI,
Yes it is possible to add tags to your SQL query. there are 3 options available.
Option 1:VB Script or Function where you can use VB Variables to build the query and then the $DBExecute function. something like this:
Dim SQL
SQL = "SELECT FROM Table WHERE Column = " & $TagName
$DBExecute("Connection",SQL)
Option 2: You can also use the script database command $DBSelect command with the syntax below.
DBSelect("DB1","Table1","Array1,Array2","Column1,Column2","","")
Option 3: You can use the database worksheets in the Tasks->Database/ERP folder, the condition field would be your select where from would be.
Hopefully this helps!
Posted: 2021-04-08 11:32 PM . Last Modified: 2021-04-08 11:33 PM
Thanks Paul and Tom
This was just what I was looking for.
User | Count |
---|---|
9 | |
6 | |
5 | |
5 | |
3 | |
3 |
Create your free account or log in to subscribe to the forum - and gain access to more than 10,000+ support articles along with insights from experts and peers.