Welcome to the new Schneider Electric Community

It's your place to connect with experts and peers, get continuous support, and share knowledge.

  • Explore the new navigation for even easier access to your community.
  • Bookmark and use our new, easy-to-remember address (community.se.com).
  • Get ready for more content and an improved experience.

Contact SchneiderCommunity.Support@se.com if you have any questions.

Close
Invite a Co-worker
Send a co-worker an invite to the Exchange portal.Just enter their email address and we’ll connect them to register. After joining, they will belong to the same company.
Send Invite Cancel
84766members
354199posts

Tags in SQL statements?

AVEVA Plant SCADA Forum

A support forum for AVEVA Plant SCADA (formerly Citect SCADA). Share new and exciting product information, connect, learn, and collaborate with the ecosystem of Plant SCADA Users. AVEVA Plant SCADA a reliable, flexible and high-performance Supervisory Control and Data Acquisition software solution for industrial process customers. This forum is to connect, share, learn and collaborate new and exciting product information. Feel free to join and share to your Ecosystem of Plant SCADA Users.

Solved
jthyge
Ensign
Ensign
0 Likes
4
1840

Tags in SQL statements?

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

Tags (1)

Accepted Solutions
Paul_Derbyshire
Ensign Ensign
Ensign
1
1817

Re: Tags in SQL statements?

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


 

Paul Derbyshire
Senior Product Application Expert | Sales Enablement | HMI Line of Business, Digital Factory | Industrial Automation Business | Schneider Electric

See Answer In Context

Tags (1)
4 Replies 4
Rodrigo_Garcia
Administrator Administrator
Administrator
0
1830

Re: Tags in SQL statements?

Hello @TomDroll , Could you support on this?

 

Regards,

 

Rodrigo G. 


Industrial Automation Community manager

Tags (1)
Paul_Derbyshire
Ensign Ensign
Ensign
1
1818

Re: Tags in SQL statements?

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


 

Paul Derbyshire
Senior Product Application Expert | Sales Enablement | HMI Line of Business, Digital Factory | Industrial Automation Business | Schneider Electric

Tags (1)
TomDroll
Lt. Commander Lt. Commander
Lt. Commander
0
1815

Re: Tags in SQL statements?

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!

 

 

 

 

 
 

 

 

 

 

 

Tom Droll
Attachments
Tags (1)
jthyge
Ensign
Ensign
0 Likes
0
1801

Re: Tags in SQL statements?

Thanks Paul  and Tom

 

This was just what I was looking for. 

 

 

Tags (1)