Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ InTouch HMI

SQL server database applications

  • Last UpdatedJun 17, 2024
  • 2 minute read

You use the SQLConnect() function in an InTouch QuickScript to connect to a Microsoft SQL Server database. The SQLConnect() function logs on a user to a SQL Server database and opens a connection. The connection string used by the SQLConnect() function is formatted as follows:

(SQLConnect(ConnectionId,"<attribute>=<value>;
<attribute>=<value>;...");

The ConnectionID argument is an integer tag containing a session number. This session number is used by almost every other SQL Access function to reference the connection to the SQL Server database. The session number increments by 1 with each SQLConnect() function call.

The following table describes the SQLConnect() function attributes used by Microsoft SQL Server:

Attribute

Value

Provider

SQLOLEDB

Data Source

Server name where the database is installed

Initial Catalog

Database name

User ID

Logon ID, case sensitive

Password

Password, case sensitive

"Provider=SQLOLEDB.1;User ID=UserIDStr; Password=PasswordStr;Initial Catalog=DatabaseName;Data Source=ServerName;"

SQL Access Manager associates the four types of InTouch tags (discrete, integer, real, and message) with other SQL Server database data types.

Data Type

Length

Range

Tag Type

char

8,000 characters

1 to 131

message

int

-2,147,483,648 to 2,147,483,647

integer

float

15 digits

-1.79E+308 to 1.79E+308

real

The char data type contains fixed-length character strings. InTouch message tags require a char data type. A field length must be specified. Microsoft SQL Server databases support a char field with a maximum length of 8,000 characters. However, InTouch message tags are limited to 131 characters. If a message tag value contains more characters than the length specified for a database field, the char string is truncated when inserted into the database.

The int data type represents InTouch integer tags. If a field length is not specified, the length is set to the default value of the database. If the length is specified, it is in the form Width. The Width determines the maximum number of digits for the column.

The float data type represents InTouch real tags. The field length setting is fixed by the database. A field length for this data type is not required.

TitleResults for “How to create a CRG?”Also Available in