Overview
WinCC Flexible 2008 stores process values such as temperature, pressure, and flow in a tag logging archive. By default, the runtime writes archives to a file-based Microsoft Access-compatible database on the HMI panel's local storage. For multi-station reporting, batch traceability, or historian integration, the same archive can be redirected to a Microsoft SQL Server relational database through a 32-bit ODBC connection. The runtime then creates the archive tables, appends rows at the configured logging cycle, and exposes the data to any OLE DB or ODBC consumer — including the WinCC runtime itself, a custom VBScript, Microsoft Excel, Power BI, or a .NET application.
This reference walks through SQL Server setup, 32-bit ODBC configuration, the WinCC Flexible project wiring, archive schema details, read/write scripting, the resolution of the two most common connection errors (ODBC error 2147467259 and -2147217900), and a migration path to the TIA Portal WinCC Archive Connector for projects that have moved to WinCC Runtime Professional.
Prerequisites
- WinCC Flexible 2008 (any service pack) installed on a Windows 7, Windows Server 2008 R2, or later engineering and runtime station. WinCC Flexible is a 32-bit application and must remain on a 32-bit or 64-bit OS with the WoW64 subsystem enabled.
- Microsoft SQL Server 2005, 2008, or 2012 installed either locally on the HMI station or on a separate server in the same domain/workgroup. Express editions are supported for small installations up to the SQL Server Express storage limit (currently 10 GB per database for SQL Server 2012 Express).
- SQL Server Management Studio for creating the target database, login, and schema.
- SQL Server authentication set to mixed mode (Windows + SQL). The WinCC runtime service account typically authenticates as a SQL login rather than a Windows account.
- The matching SQL Server Native Client ODBC driver installed on the runtime station (10.0 for SQL Server 2008, 11.0 for SQL Server 2012). Install via the SQL Server installation media or download from the Microsoft Download Center.
- 32-bit ODBC Data Source Administrator accessible at
%windir%\SysWOW64\odbcad32.exeon 64-bit Windows. This is the only ODBC administration tool that WinCC Flexible 2008 will read. - For projects migrating to TIA Portal: WinCC Runtime Professional V14 or later, plus the current WinCC Archive Connector documentation set.
SQL Server and Database Configuration
- Open SQL Server Management Studio and connect to the instance that will hold the archive. Right-click Databases → New Database and create a database with a meaningful name such as
WinCC_Archive. - Set the recovery model to
SIMPLEin Database Properties → Options. Full recovery on a continuously written archive database causes uncontrolled transaction-log growth and degrades commit latency. - Set
Auto ClosetoOFF.Auto Closeshuts down the database after the last connection exits, which forces a 30-60 second re-initialization on every WinCC Flexible runtime start. - Right-click Security → Logins → New Login. Create a SQL login (e.g.,
wincc_user) with a strong password. On the User Mapping page, map the login toWinCC_Archiveand grant the rolesdb_datareader,db_datawriter, anddb_ddladmin. Thedb_ddladminrole is required because WinCC Flexible creates the archive tables on first connection. - Open Server Properties → Security and set Server Authentication to
SQL Server and Windows Authentication mode. Restart the SQL Server service to apply. - Confirm TCP/IP is enabled in SQL Server Configuration Manager → Network Configuration → Protocols for MSSQLSERVER. The default instance listens on TCP 1433; named instances use a dynamic port and require the SQL Server Browser service to be running.
- Open port 1433 (or the configured dynamic port) in Windows Firewall for the WinCC runtime subnet.
ODBC Data Source Configuration
- On the WinCC Flexible runtime station, open the 32-bit ODBC Data Source Administrator. On 64-bit Windows:
%windir%\SysWOW64\odbcad32.exe. On 32-bit Windows:%windir%\System32\odbcad32.exe. - Select the System DSN tab. System DSN is visible to all users and to Windows services, which is what the WinCC runtime requires. Click Add.
- Select SQL Server Native Client 11.0 (or SQL Server if the native client is not listed) as the driver. Click Finish.
- Enter a descriptive name (e.g.,
WinCC_Archive_DSN) and a short description. In the Server dropdown, select the SQL Server instance or typeSERVERNAME\INSTANCENAME. Click Next. - Choose With SQL Server authentication using a login ID and password entered by the user. Enter the
wincc_userlogin and password created in the previous section. Click Next. - Change the default database to
WinCC_Archive. Leave the default settings for ANSI options unless you have a documented reason to change them. Click Next. - On the final page, click Test Data Source. The dialog must return Tests Completed Successfully!. If it fails, verify the SQL Server service is running, TCP 1433 is reachable, and the login credentials are correct.
- Click OK to save the DSN. It now appears in the System DSN list with the configured driver and target database.
HKLM\SOFTWARE\ODBC\ODBC.INI, which the 32-bit process cannot see. The 32-bit administrator writes to HKLM\SOFTWARE\WOW6432Node\ODBC\ODBC.INI. Mixing the two is the single most common cause of ODBC error 2147467259.WinCC Flexible Project Configuration
- Open the project in WinCC Flexible ES. In the project tree, expand Tag Logging. A default archive is created automatically when the project is generated; right-click Archive and confirm the archive exists.
- Open the archive and add the tags to be logged (e.g.,
Temperature_PV,Pressure_PV). For each tag, configure:-
Acquisition cycle: how often WinCC reads the process value from the PLC (typical:
500 msfor pressure,1 sfor temperature). -
Archiving cycle: how often the value is written to the database. Decouple acquisition from archiving — archive at
1 sfor high-speed,5 sor10 sfor slow-changing temperatures to reduce database load. - Limit values: optional high/low thresholds for compression.
-
Acquisition cycle: how often WinCC reads the process value from the PLC (typical:
- Open Project → Runtime Settings → Tag Logging. Locate the option for the archive database type. Select Relational database (ODBC) and enter the exact DSN name from the previous section (
WinCC_Archive_DSN). - Enter the SQL login credentials (
wincc_userand password) in the runtime settings dialog, or configure them in a WinCC user administration entry and reference it from the script. - Compile the project and transfer it to the HMI runtime. On the first start of runtime, WinCC Flexible executes
CREATE TABLEstatements to create the archive tables (default nameARCHIVE_1, with one row per archive entry). The runtime then appends one row per archive cycle. - Confirm in SQL Server Management Studio that the tables exist and contain rows with current timestamps. Run:
SELECT TOP 10 * FROM WinCC_Archive.dbo.ARCHIVE_1 ORDER BY Timestamp DESC.
Database Schema Generated by WinCC Flexible
WinCC Flexible creates the archive schema on first connection. The exact column set depends on the service pack and the tag data type, but the canonical schema for an analog tag archive is:
| Column | SQL Type | Description |
|---|---|---|
ID |
BIGINT IDENTITY(1,1) |
Monotonically increasing primary key. |
Timestamp |
DATETIME |
Time the value was archived, in UTC by default. WinCC stores local time if the runtime is configured to do so. |
TagName |
NVARCHAR(255) |
WinCC tag name as configured in the project. |
RealValue |
FLOAT |
Numeric value of the tag at the archive time. Binary tags use a separate BinaryValue column. |
Quality |
SMALLINT |
OPC quality code: 0 = Bad, 64 = Good, 128 = Uncertain, etc. |
Flags |
INT |
Bitmask for archive flags (e.g., substitution value, time jump correction). |
User |
NVARCHAR(64) |
WinCC user name if the value was written by operator action. |
Additional columns are generated for limit violations, comments, and trend references. Always inspect the actual schema with sp_help 'ARCHIVE_1' in SSMS before writing queries against it; the column set is project-specific.
Reading Archived Data with VBScript
The WinCC Flexible runtime supports VBScript in screen events, scheduler tasks, and global actions. Use the ADODB.Connection and ADODB.Recordset COM objects to query the SQL archive directly.
Connection String Variants
| Provider | Connection String | Notes |
|---|---|---|
| OLE DB (recommended) | Provider=SQLOLEDB;Data Source=SERVER\INSTANCE;Initial Catalog=WinCC_Archive;User ID=wincc_user;Password=YourPassword; |
Most stable on WinCC Flexible 2008. |
| ODBC via DSN | DSN=WinCC_Archive_DSN;UID=wincc_user;PWD=YourPassword; |
Use if a DSN is configured but no provider is registered. |
| SQL Server Native Client 11.0 | Provider=SQLNCLI11;Data Source=SERVER;Initial Catalog=WinCC_Archive;User ID=wincc_user;Password=YourPassword; |
Use for SQL Server 2012 with TLS 1.2. |
Read the Last N Records for a Single Tag
Sub ReadArchiveLastN(sTagName As String, lCount As Long)
Dim conn, rs, sql
Set conn = CreateObject("ADODB.Connection")
conn.ConnectionString = "Provider=SQLOLEDB;Data Source=YOURSERVER;Initial Catalog=WinCC_Archive;User ID=wincc_user;Password=YourPassword;"
conn.Open
sql = "SELECT TOP " & lCount & " [Timestamp], [RealValue], [Quality] FROM ARCHIVE_1 WHERE TagName = '" & sTagName & "' ORDER BY [Timestamp] DESC"
Set rs = CreateObject("ADODB.Recordset")
rs.CursorType = 3 ' adOpenStatic
rs.LockType = 1 ' adLockReadOnly
rs.Open sql, conn
Do While Not rs.EOF
HMIRuntime.Trace "Tag=" & sTagName & " T=" & rs("Timestamp") & " V=" & rs("RealValue") & " Q=" & rs("Quality") & vbCrLf
rs.MoveNext
Loop
rs.Close
conn.Close
Set rs = Nothing
Set conn = Nothing
End Sub
Read a Time-Range Aggregation
Sub ReadAggregate(sTagName As String, dtFrom As Date, dtTo As Date)
Dim conn, rs, sql
Set conn = CreateObject("ADODB.Connection")
conn.ConnectionString = "Provider=SQLOLEDB;Data Source=YOURSERVER;Initial Catalog=WinCC_Archive;User ID=wincc_user;Password=YourPassword;"
conn.Open
sql = "SELECT MIN([RealValue]) AS MinV, MAX([RealValue]) AS MaxV, AVG([RealValue]) AS AvgV, COUNT(*) AS Cnt " & _
"FROM ARCHIVE_1 WHERE TagName = '" & sTagName & "' AND [Timestamp] BETWEEN '" & Format(dtFrom, "yyyy-mm-dd hh:nn:ss") & "' AND '" & Format(dtTo, "yyyy-mm-dd hh:nn:ss") & "'"
Set rs = CreateObject("ADODB.Recordset")
rs.Open sql, conn
If Not rs.EOF Then
HMIRuntime.Trace "Min=" & rs("MinV") & " Max=" & rs("MaxV") & " Avg=" & rs("AvgV") & " Cnt=" & rs("Cnt") & vbCrLf
End If
rs.Close
conn.Close
Set rs = Nothing
Set conn = Nothing
End Sub
Bind the sub to a button Press event. The output appears in the WinCC diagnosis window, which is reachable via Start → Programs → Siemens Automation → WinCC Flexible → Diagnosis or the HMIRuntime.Trace log.
Writing External Data into the WinCC Archive
External systems can append rows directly to the archive tables, but doing so bypasses WinCC's value-change detection and time-correction logic. If you must write external data, follow this pattern:
Sub WriteExternalValue(sTagName As String, vValue As Variant, dtStamp As Date)
Dim conn, sql
Set conn = CreateObject("ADODB.Connection")
conn.ConnectionString = "Provider=SQLOLEDB;Data Source=YOURSERVER;Initial Catalog=WinCC_Archive;User ID=wincc_user;Password=YourPassword;"
conn.Open
sql = "INSERT INTO ARCHIVE_1 ([Timestamp], [TagName], [RealValue], [Quality], [Flags]) " & _
"VALUES ('" & Format(dtStamp, "yyyy-mm-dd hh:nn:ss") & "', '" & sTagName & "', " & CDbl(vValue) & ", 64, 0)"
conn.Execute sql, , 128 ' adExecuteNoRecords
conn.Close
Set conn = Nothing
End Sub
Set Quality to 64 (Good) for normal values, 0 (Bad) for missing data, and 128 (Uncertain) for substituted values. Avoid inserting rows with future timestamps — the runtime will reject them during the next read cycle.
WinCC OLE DB Provider
The WinCC OLE DB Provider (WinCC OLE DB Provider 1.0) is a specialized OLE DB data source installed with the WinCC runtime. It exposes both the SQL archive and the in-memory tag image table, allowing read access from VBScript without a custom connection string. Typical use cases are trend views and historian dashboards that need a stable, version-controlled interface.
Connection string: Provider=WinCCOLEDBProvider.1;Catalog=WinCC_Archive;Data Source=YOURSERVER;User ID=wincc_user;Password=YourPassword;
The provider is read-only; use the standard SQLOLEDB provider for writes. Refer to the official Siemens Support FAQ 24677043 for the configuration of the OLE DB provider in WinCC Flexible.
Troubleshooting Matrix
| Error Code | Source | Message | Root Cause | Resolution |
|---|---|---|---|---|
2147467259 (0x80004005) |
ODBC Driver Manager | Data source name not found and no default driver specified. | DSN created in 64-bit ODBC admin, or DSN name typo, or DSN driver missing. | Re-create DSN in 32-bit admin (SysWOW64\odbcad32.exe). Verify name matches WinCC runtime settings character-for-character. Install SQL Server Native Client. |
-2147217900 |
SQL Server / ODBC SQL Server Driver | Incorrect syntax near '(' | SQL query contains unsupported syntax for the target version, or string concatenation produced an orphan parenthesis, or reserved keyword used unbracketed. | Log the final SQL string with HMIRuntime.Trace. Validate in SSMS. Quote reserved words with [ ]. Replace TOP 10 PERCENT with TOP 10 on older drivers. |
18456 |
SQL Server | Login failed for user 'wincc_user'. | Wrong password, mixed-mode auth disabled, login not mapped to database, or AD account lockout. | Verify login in SSMS. Re-enable mixed-mode auth and restart SQL. Reset password and re-enter in WinCC runtime settings. |
4060 |
SQL Server | Cannot open database "WinCC_Archive" requested by the login. | Database offline, removed, or login lacks connect permission. | Confirm database exists. In Login Properties → User Mapping, grant public + db_datareader. |
208 |
SQL Server | Invalid object name 'ARCHIVE_1'. | Runtime has not yet created the table, or wrong database selected. | Restart WinCC runtime to trigger table creation. Verify connection string Initial Catalog points to WinCC_Archive. |
-2147217865 |
SQL Server / ODBC | Cannot find the object "ARCHIVE_1" because it does not exist or you do not have permissions. | Same as 208 plus missing db_ddladmin role for the login. |
Grant db_ddladmin role, restart runtime, recreate the archive from the WinCC project. |
53 |
ODBC SQL Server Driver | Named Pipes Provider: Could not open a connection to SQL Server. | SQL Server Browser not running, named instance not registered, or firewall blocking. | Start SQL Server Browser. Use SERVER\INSTANCE format. Open TCP 1433 in Windows Firewall. |
Error #2147467259 Deep Dive: Data Source Name Not Found
This ODBC error (IM002 in the native ODBC error code) fires when the ODBC driver manager cannot match the DSN name passed by the application to a registered system or user DSN. In a WinCC Flexible deployment, the typical chain is:
- WinCC runtime reads the DSN name from the project settings and passes it to the ODBC driver manager via
SQLConnect. - The driver manager enumerates the DSNs in
HKLM\SOFTWARE\WOW6432Node\ODBC\ODBC.INI\ODBC Data Sources(32-bit) andHKLM\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources(64-bit). - If the DSN is in the 64-bit hive only, the 32-bit process returns
IM002, which WinCC surfaces as error2147467259.
Resolution steps in order:
- Open
%windir%\SysWOW64\odbcad32.exeon 64-bit Windows. Confirm the DSN is listed under System DSN. - If the DSN is missing, run the SQL Server configuration wizard and add the DSN, selecting the SQL Server Native Client 11.0 driver.
- Confirm the driver listed for the DSN is present on the system. The Drivers tab shows all installed ODBC drivers. A missing entry indicates the SQL Server Native Client is not installed.
- Verify the DSN name in the WinCC project matches the registered DSN exactly. Windows is case-insensitive, but the names must match character-for-character.
- Restart the WinCC Flexible runtime service after any DSN change. The DSN cache is populated at service start.
Error #-2147217900 Deep Dive: Incorrect Syntax Near '('
The negative value -2147217900 is the signed 32-bit representation of HRESULT 0x80040E14, which maps to native ODBC error 37000 (syntax error). The error fires from the SQL Server parser, not from ODBC, which means the query was successfully delivered to SQL Server but rejected during parsing.
Common triggers in WinCC Flexible VBScript:
- Reserved keyword used unbracketed —
Timestamp,Value,User,Table,Orderare reserved in T-SQL. Wrap in[ ]:[Timestamp],[User]. - Parenthesized expression in
WHEREbroken across lines without continuation. The WinCC script editor does not always handle line-continuation characters consistently. -
TOPwithPERCENTon drivers that do not supportSELECT TOP n PERCENT. Replace withSELECT TOP (CAST(n AS FLOAT)/COUNT(*)*100) PERCENTsubquery, or simplify toSELECT TOP n. - String concatenation that produces trailing whitespace, then a stray opening parenthesis at the end of the query string.
- Use of
JOINsyntax targeting a version that requires the olderWHERE-style join.
Resolution pattern:
- Add
HMIRuntime.Trace "SQL=" & sql & vbCrLfimmediately beforers.Opento capture the final query string. - Open SQL Server Management Studio, paste the logged string into a new query window, and execute it. SSMS will report the exact parser error location.
- Rewrite the query in a version-safe form, e.g., always use explicit
JOIN ... ONsyntax, always bracket reserved words, and useSELECT TOP nwithoutPERCENT. - Re-run from WinCC. The error should be gone if the SSMS test passes.
WinCC RT Professional: Archive Connector
For projects that have migrated from WinCC Flexible to WinCC Runtime Professional in TIA Portal, the WinCC Archive Connector provides a more modern SQL Server integration. The Archive Connector re-connects already swapped-out WinCC archives to a SQL Server, decoupling the storage backend from the runtime and supporting parallel read access from multiple clients (DataMonitor, WinCC OLE DB Provider, custom .NET applications).
Key differences from the WinCC Flexible ODBC approach:
| Aspect | WinCC Flexible 2008 + ODBC | WinCC RT Professional + Archive Connector |
|---|---|---|
| Configuration surface | Runtime settings dialog, manual DSN creation | TIA Portal project tree, no manual ODBC |
| Authentication | SQL login, password in project | Windows integrated auth, certificate, or managed credential store |
| Swappable archives | Limited; requires runtime restart | Native; runtime swaps segments on schedule |
| Multi-client read | Possible but contention-prone | Native, scales to 50+ concurrent DataMonitor clients |
| SQL Server support | 2005, 2008, 2012 | 2012 and later, including 2019, 2022 with TLS 1.2/1.3 |
For new TIA Portal deployments, prefer the Archive Connector. For legacy WinCC Flexible systems that cannot be migrated, the ODBC + VBScript pattern described above remains the supported approach. See the TIA Portal V20 Archive Connector documentation for the current configuration procedure.
Performance and Sizing
SQL Server sizing for a WinCC Flexible archive depends on the number of tags, the archive cycle, the retention period, and the query pattern. Use the following rules of thumb for an Express-class deployment:
- Row size for an analog tag archive: approximately 80 bytes (ID + Timestamp + TagName + RealValue + Quality + Flags + User + row overhead).
- Disk usage per tag per day = (86,400 seconds / archive cycle) × 80 bytes. For a 1-second cycle: 6.9 MB/day per tag. For a 5-second cycle: 1.4 MB/day per tag.
- SQL Server 2012 Express caps the database at 10 GB. With 100 tags at a 5-second cycle, that is roughly 70 days of retention — plan rotation or migration to a licensed SQL Server for longer retention.
- Index the archive table on
(TagName, Timestamp)to accelerate time-range queries. WinCC Flexible does not create this index automatically. Add it once with SSMS:CREATE INDEX IX_ARCHIVE_1_Tag_Time ON ARCHIVE_1 (TagName, Timestamp); - Partition the archive table by month if retention exceeds 90 days, to keep index rebuilds and statistics updates within a maintenance window.
Security and Operational Best Practices
- Use a dedicated SQL login for the WinCC connection. Do not reuse
sa. Grant onlydb_datareader,db_datawriter, anddb_ddladminon the archive database, nothing on the master database. - Store the SQL password in a WinCC user administration entry with a permission level of at least "Operator" and reference the entry from the script via
HMIRuntime.Tags("@Password"). This avoids plaintext passwords in exported projects. - Restrict the DSN password visibility by marking the ODBC DSN as not saving the password at the Windows user level. The system DSN will then require the password to be supplied by the connecting application on every connection.
- Enable TLS 1.2 on the SQL Server and configure the SQL Server Native Client 11.0 to require encrypted connections. This is mandatory for compliance with most modern cybersecurity standards.
- Schedule a daily
DBCC SHRINKFILEon the transaction log only if you have monitored growth and confirmed a backlog of freed space. Shrinking the data file fragments the disk and degrades archive write throughput. - Back up the archive database nightly using SQL Server native backup or a third-party tool. Test the restore procedure quarterly. WinCC Flexible does not provide an internal backup of the archive database.
Verification Procedure
- Start the WinCC Flexible runtime on the HMI station. Confirm the runtime status indicator turns green and no alarms fire within the first 60 seconds.
- Open SQL Server Management Studio on the database server. Run
SELECT TOP 5 * FROM WinCC_Archive.dbo.ARCHIVE_1 ORDER BY Timestamp DESC. Confirm recent rows are present with the expected tag names and quality codes. - Trigger the VBScript read sub from an HMI button. Confirm the diagnosis window lists the expected number of records with non-zero
RealValuefor the active tags. - Trigger the time-range aggregate sub. Confirm the
Min,Max, andAvgvalues match the actual process readings within engineering tolerance. - Open Windows Event Viewer on the runtime station. Filter for ODBC and SQL Server sources over the last hour. Zero error events is the expected outcome.
- Reboot the HMI station to verify the DSN persists across restarts and the runtime re-creates its connection within the configured retry interval.
Field-Proven Caveats
- Do not point the ES and the runtime at the same SQL database. Design-time metadata writes from the ES will lock the archive tables and stall runtime writes.
- Exclude the SQL Server data and log directories from antivirus on-access scanning. Real-time scanning of
.mdfand.ldffiles causes 2-5 second stalls that exceed typical 1-second archive cycles and produce gaps in the archive. - Avoid using the same DSN for read-only consumers and the WinCC runtime. Mixed-purpose DSNs pick up transient locks from reporting tools and surface them as runtime alarms. Create a separate DSN for BI tools with a read-only login.
- The minimum archive cycle in WinCC Flexible 2008 is 1 second. Sub-second logging requires the file-based archive with a custom scheduled script to forward values to SQL.
- The
Timestampcolumn is stored in the SQL Server's local time zone, not UTC, by default. Configure the runtime explicitly to UTC for multi-site deployments, or convert at query time withAT TIME ZONE(SQL Server 2016+) orDATEADDhour offset. - The
Usercolumn is only populated for operator-initiated writes via the WinCC runtime UI. Automated script writes leave the columnNULLunless the script explicitly sets it. - Long-running VBScript queries (over 30 seconds) hold the connection open and block runtime writes. Use server-side aggregation queries and limit result sets to under 10,000 rows per call.
FAQ
Why does WinCC Flexible not see the ODBC DSN I created?
You almost certainly created the DSN in the 64-bit ODBC administrator. WinCC Flexible 2008 is a 32-bit application and reads the registry hive at HKLM\SOFTWARE\WOW6432Node\ODBC\ODBC.INI. Re-create the DSN in the 32-bit administrator (%windir%\SysWOW64\odbcad32.exe on 64-bit Windows).
What is the minimum SQL Server edition supported by WinCC Flexible 2008?
SQL Server 2005 Express or higher is supported. SQL Server 2012 Express is the latest version that is broadly field-validated; SQL Server 2014 and later changed ODBC driver behavior and the WinCC OLE DB provider does not enumerate the new drivers correctly without manual configuration.
Can external applications read the archive data outside WinCC?
Yes. Any ODBC or OLE DB consumer can query the archive tables, including Microsoft Excel (Data → From Other Sources → From SQL Server), Power BI, and .NET applications using System.Data.SqlClient. Use a read-only SQL login and do not write to the archive tables from external tools.
How do I migrate from the file-based archive to SQL Server?
Stop the runtime, then in WinCC Flexible ES open Project → Runtime Settings → Tag Logging and change the database type from file-based to relational database (ODBC). On the next runtime start, the project creates empty archive tables on the SQL Server; historical data from the file-based archive is not auto-imported — use the WinCC OLE DB Provider to read the old data and write it to SQL if needed.
What replaced this approach in WinCC Runtime Professional?
The WinCC Archive Connector, documented for TIA Portal V14 through V20, reconnects swapped-out archives to a SQL Server and exposes them through the WinCC OLE DB Provider and the DataMonitor client. See the TIA Portal V20 Archive Connector documentation for the current configuration procedure.