FactoryTalk View SE Data logging in MS-SQL

Published on May18, 2025 | Category: sql
Share this article:

Microsoft SQL Server (MS-SQL) is a powerful relational database management system (RDBMS) developed by Microsoft. It is designed to store, retrieve, and manage large volumes of data efficiently and securely. MS-SQL can be installed on both Windows and Linux operating systems and is accessible through a wide range of client tools, graphical interfaces (like SQL Server Management Studio), and programming APIs. In industrial automation, particularly in PLC and SCADA applications, MS-SQL plays a vital role in data management. It is commonly used to store process data such as alarm logs, event logs, historical trends, tag values, and critical process variables. This stored data can be used for real-time monitoring, analysis, reporting, diagnostics, and audit purposes. MS-SQL provides robust features such as:

MS-SQL supports multiple programming languages including SQL, Transact-SQL (T-SQL), .NET, C#, Visual Basic, and Java, allowing developers to build rich and interactive industrial applications. It is available in several editions tailored for different use cases: In this article, we use the Express Edition of MS-SQL Server for demonstration purposes. You can download the latest version of MS-SQL Express from the official Microsoft website. The download link is provided at the end of this article.

FactoryTalk View SE ODBC Database Storage

ODBC, or Open Database Connectivity, is a standardized interface developed by Microsoft that allows Windows-based applications to access data from different database management systems such as MySQL, Oracle, and Microsoft SQL Server. It enables connectivity through a set of standard APIs and supports functions like connecting to databases, executing SQL queries, retrieving data, and managing transactions. ODBC drivers are available in both 32-bit and 64-bit versions, and are widely used in various industries for database integration and communication.

img/Data logging in MSSQL/Factorytalk View SE ODBC database storage.webp

Create Database In MS-SQL Server for FactoryTalk View Data Logging

Before proceeding, download and install the MS-SQL Server Express edition. This edition is free and ideal for small-scale development, desktop, and SCADA data logging applications.

To create a new database in SQL Server:

img/Data logging in MSSQL/create database in mssql server for FactoryTalk View for Datalogging.webp

Connecting SQL Server to FactoryTalk View SE for Data Logging

In FactoryTalk View Studio, open the Data Log folder in the Explorer panel. Right-click on Data Log Models and choose New. In the setup tab of the Data Log Model editor, select ODBC Data Source as the storage format to connect with SQL Server.

img/Data logging in MSSQL/How To Connect SQL server in FactoryTalk View for Datalogging.webp

FactoryTalk View ODBC Table Names

When selecting ODBC as the storage format, three types of tables are available:

The default table names are TagTable, FloatTable, and StringTable. It is recommended to keep these names unchanged for simplicity.

img/Data logging in MSSQL/factorytalk view ODBC tables name.webp

How to Log Data to ODBC Data Sources in FactoryTalk View SE

You can store data in either an existing or new ODBC Data Source. Follow these steps to configure a new one:

img/Data logging in MSSQL/how to Log data to ODBC data sources in factorytalk view se.webp img/Data logging in MSSQL/Select the System Data Source tab.webp img/Data logging in MSSQL/Select System Data Source.webp img/Data logging in MSSQL/select sql server and click next.webp img/Data logging in MSSQL/Enter a Name and Description of your DSN.webp img/Data logging in MSSQL/select autohantication mode of your DSN.webp img/Data logging in MSSQL/select database.webp img/Data logging in MSSQL/test The DSN configured.webp img/Data logging in MSSQL/ODBC Data Source select your dsn.webp img/Data logging in MSSQL/press create table button for creating table.webp

Configure ODBC Backup Path in FactoryTalk View Studio

To prevent data loss when the SQL server is unreachable, you can configure a backup path for your ODBC data source. Select Enable ODBC Backup Path and specify an absolute or relative path to store temporary data files.

img/Data logging in MSSQL/ODBC backup path for datalog in factorytalk view studio.webp

Auto Purge Old Records in ODBC Database

In the File Management tab, you can define rules to automatically delete old records after a specified duration. This helps in managing disk space and ensuring your database remains optimized.

img/Data logging in MSSQL/purge old records from the database in factorytalk view studio datalog.webp

Define Logging Triggers in FactoryTalk View Studio

In the Log Triggers tab, configure when data should be logged:

img/Data logging in MSSQL/Specify when to store data in factorytalk view studio datalog.webp

How to Add Tags to the ODBC Data Source

Navigate to the Tags In Model tab to browse and select the tags you want to log. Each data log model can handle up to 10,000 tags of any data type.

img/data log model/how to select data for data logging in factorytalk data log model.webp

Save ODBC Data Source Configuration

After all configurations are complete, click OK and assign a meaningful name to your Data Log Model. This name will be used in scripts and triggers.

img/data log model/set component name of of data log model.webp

Start Data Logging in FactoryTalk View

You can start data logging using one of the following methods:

img/Data logging in MSSQL/Start Data Logging In Factorytalk Datalog Model.webp

Stop Data Logging in FactoryTalk View

To stop data logging:

img/Data logging in MSSQL/Stop Data Logging In Factorytalk Datalog Model.webp

Verify Data Logging in SQL Server

Open Microsoft SQL Server Management Studio (SSMS), connect to your database, and browse the tables. If configured properly, you will find three tables: FloatTable, StringTable, and TagTable.

img/Data logging in MSSQL/check your datalogging in ms-sql server.webp

Float Table Format:

Tag Table Format: