WinCC Tag Deletion Failed: Fix Structure Element Error

David Krause14 min read
SiemensTroubleshootingWinCC
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

Problem Overview

When configuring a Siemens WinCC project, an engineer or commissioning technician creates a tag using an invalid character — most commonly a dot (.) where an underscore (_) was intended. The tag is accepted by the tag dialog and saved to the WinCC project database. A subsequent attempt to delete that tag returns the dialog error:

"The selected object is a structure element or contains structure elements. First delete the associated structure tag and then repeat the deletion procedure."

WinCC refuses the deletion because the tag has been internally registered as a child element of an implicit (orphaned) structure tag, or because the name-validation rules of a structure element have been violated by the user input. The tag cannot be deleted through the standard Tag Management editor, the Tag Logging editor, the Alarm Logging editor, or the WinCC Explorer. This article documents two field-proven recovery paths: (1) direct manipulation of the Microsoft SQL Server configuration database, and (2) the official WinCC Configuration Tool add-on for Microsoft Excel. A prevention section, a verification procedure, a troubleshooting matrix, and a FAQ close the reference.

Why This Happens: WinCC Tag Naming and Structure Mechanics

WinCC project databases (files with the extension .mcp) and runtime databases (Microsoft SQL Server databases prefixed with the project name and ending in R) enforce a strict naming convention for tags. Tags can exist in three forms:

Tag Type Format Example Permitted Characters
Scalar tag Single name Pump_01_Run A–Z, a–z, 0–9, underscore (_)
Structure tag Single name referencing a UDT Motor_Data A–Z, a–z, 0–9, underscore (_)
Structure element Child member of a UDT Speed, Current A–Z, a–z, 0–9, underscore (_)

The dot character (.) is reserved internally as the structure-element separator when the runtime engine resolves a hierarchical tag path such as MyStruct.Motor.Speed. When a tag named Pump.01.Run is entered into the Tag Management editor, WinCC does not always reject the name at the input prompt (depending on the WinCC version and locale settings). Instead, the editor interprets it as element Run inside element 01 inside structure Pump. If those parent structures were never formally defined as UDTs in the project library, WinCC creates implicit (orphaned) structure rows in the dbo.MCPTVARIABLEDESC and dbo.MCPSTRUCTURE tables to satisfy the reference. Once those implicit structure rows exist, the Tag Management dialog refuses to delete the leaf tag until the parent structure tag is deleted first — and the parent structure cannot be deleted through the UI because it has no graphical representation in any editor.

Critical: A dotted tag name is not the same as a legitimate WinCC structure instance. A valid structure tag references a defined UDT from the master library; an orphan tag with dots creates phantom structure rows in the database that the WinCC editor cannot visualize or purge through standard commands.

How WinCC Stores Tags: Database Schema Reference

WinCC V7.x and WinCC V8 (TIA Portal) both use Microsoft SQL Server as the project backend. The configuration database and the runtime database are separate, even though they share a project name prefix. The relevant tables for tag definition are:

Table Database Content Editable via Tag Management?
dbo.MCPTVARIABLEDESC Configuration (<Project>) Tag names, data types, structure references, limits Yes (normal path)
dbo.MCPSTRUCTURE Configuration (<Project>) UDT definitions and structure element types Yes (Structure editor)
dbo.MCPMESSAGE Configuration (<Project>) Alarm/message text referencing tags Yes (Alarm Logging)
dbo.MCPARCHIVE Configuration (<Project>) Tag logging archive definitions Yes (Tag Logging)
dbo.MCPSCRIPT Configuration (<Project>) C and VBS scripts referencing tags Yes (Global Script)
dbo.MCPDATA Runtime (<Project>_R) Live process values, user logs No — runtime data only

Tag deletion must be performed exclusively in the configuration database. Editing the runtime database can corrupt the archive and is never required to remove a tag definition.

Prerequisites for Recovery

Before attempting either recovery method below, perform the following preparation steps in order:

  1. Close the WinCC Explorer, the Tag Management editor, the Graphics Designer, and any client connected to the runtime database.
  2. Stop the WinCC Runtime services on the WinCC server to release exclusive locks on the SQL database. From an administrative command prompt:
    net stop "CCArchiveConnMgr"
    net stop "CCProjectMgr"
    net stop "CCRuntime"
    Alternatively, use the Windows Services console (services.msc) and stop the SIMATIC WinCC service group.
  3. Take a full backup of the WinCC project folder and the SQL databases. Back up the SQL configuration and runtime databases via SSMS or a .bak file using the maintenance plan.
  4. Identify the SQL Server instance. By default, WinCC V7 uses the SQL Server instance named WINCC; WinCC V8 (TIA Portal) uses WINCCPLUS. Verify by running SELECT @@SERVERNAME in SSMS.
  5. Confirm you have SQL db_owner rights on the WinCC configuration database, or use the SA account installed during WinCC setup.
  6. Document the corrupted tag name, the time of discovery, and the operator who created it. This becomes part of the change record.
Safety: Do not proceed without a verified backup. Both recovery methods below modify the SQL configuration database outside the normal WinCC editor workflow. A failed recovery will require a project restore from backup.

Method 1 — Direct SQL Deletion (High-Risk, Field-Proven)

This method is the original workaround circulated on Siemens support channels and reproduced by multiple field engineers. It directly modifies the configuration database table. Use only after a verified backup has been confirmed restorable.

Procedure

  1. Open Microsoft SQL Server Management Studio (SSMS) from Start → Programs → Microsoft SQL Server → SQL Server Management Studio.
  2. Click Connect. The WinCC setup installs SQL Server with mixed-mode authentication; the SA account is created during installation with the password defined in the WinCC installer wizard.
  3. In Object Explorer, expand Databases and locate the configuration database. The configuration database is named <ProjectName> (no suffix). The runtime database is <ProjectName>_R. Do not edit the runtime database for tag-definition issues.
  4. Expand the configuration database, then expand Tables. Locate dbo.MCPTVARIABLEDESC.
  5. Right-click dbo.MCPTVARIABLEDESC and select Edit Top 200 Rows (or Open Table in older SSMS versions).
  6. Locate the orphaned tag. The VARIABLENAME column contains the dotted name. Use the SSMS filter on the VARIABLENAME column. To find all suspect rows at once:
    VARIABLENAME LIKE '%.%'
  7. Review every row. Confirm that the row is not referenced by any alarm, archive, or script. Cross-check the related tables by joining on VARIABLEID:
Check Query
Alarm references SELECT * FROM dbo.MCPMESSAGE WHERE TAGID = <VariableID>
Archive references SELECT * FROM dbo.MCPARCHIVE WHERE TAGID = <VariableID>
Script references SELECT * FROM dbo.MCPSCRIPT WHERE CODE LIKE '%<TagName%'
Graphics references Search the project folder for <TagName> in .pdl files
  1. Right-click the row selector of the orphaned tag and select Delete. Confirm the deletion in the dialog.
  2. If the delete fails with a foreign-key constraint violation, identify the referencing row using the queries above and delete dependent rows first, then retry.
  3. Close SSMS. Restart the WinCC Runtime services from the administrative command prompt:
    net start "CCArchiveConnMgr"
    net start "CCProjectMgr"
    net start "CCRuntime"
  4. Open the WinCC project in the WinCC Explorer. The orphaned tag should no longer appear in Tag Management. Verify the project compiles cleanly via Project → Compile → All.
Warning: Editing the WinCC SQL database outside of the WinCC Configuration Tool is not officially supported by Siemens. A single misplaced DELETE statement, or a DELETE that ignores a foreign-key constraint, can corrupt the project to the point of forcing a full restore from backup. Always validate the full row contents and referential integrity before committing any change.

SQL Reference: Safe Identification Query

-- Identify orphaned structure references for a suspect tag
SELECT
    vd.VARIABLEID,
    vd.VARIABLENAME,
    vd.STRUCTURENAME,
    vd.STRUCTUREID,
    vd.PARENTID
FROM dbo.MCPTVARIABLEDESC AS vd
WHERE vd.VARIABLENAME LIKE '%Pump.01%'
   OR vd.STRUCTURENAME LIKE '%Pump.01%'
ORDER BY vd.STRUCTUREID, vd.PARENTID, vd.VARIABLEID;

If multiple rows are returned, delete from the deepest child first — the row with no other rows referencing its STRUCTUREID as a PARENTID — to avoid foreign-key violations during cascading deletes.

Transaction-Safe Delete Wrapper

BEGIN TRANSACTION;

-- Preview the row to be deleted
SELECT * FROM dbo.MCPTVARIABLEDESC WHERE VARIABLENAME = 'Pump.01.Run';

-- Confirm the previewed VARIABLEID matches expectations, then:
DELETE FROM dbo.MCPTVARIABLEDESC WHERE VARIABLENAME = 'Pump.01.Run';

-- Verify the row count
SELECT @@ROWCOUNT AS RowsAffected;

-- If the count is correct, commit. Otherwise roll back.
-- COMMIT TRANSACTION;
-- ROLLBACK TRANSACTION;

Method 2 — WinCC Configuration Tool in Excel (Recommended)

The WinCC Configuration Tool is an Excel COM add-on distributed on the WinCC installation media under Add-ons → Configuration Tool. It exposes the project database as an Excel workbook and supports bulk import, export, rename, and deletion of tags, alarms, and texts while respecting WinCC's internal referential checks. This is the officially supported path and the recommended approach on production systems.

Installation

  1. Insert the WinCC installation DVD or mount the ISO image.
  2. Run Setup.exe and select Custom Installation.
  3. Navigate to WinCC → Options → Configuration Tool and enable it.
  4. Complete the installation. The add-in registers itself in Microsoft Excel. Excel bitness must match the WinCC installation: WinCC V7.x requires 32-bit Office; WinCC V8 (TIA Portal) and WinCC Unified require 64-bit Office.
  5. Restart Excel to load the COM add-in.

Deletion Procedure

  1. Open Microsoft Excel (matching the bitness of your WinCC installation).
  2. Confirm the WinCC Configuration ribbon is visible. If it is missing, enable it via File → Options → Add-Ins → Manage: COM Add-Ins → Go and tick WinCC Configuration Tool.
  3. Click Open Project in the ribbon and select the project's .mcp file. Excel loads the tag table.
  4. Sort or filter the Tag Name column to locate the orphaned tag (e.g., Pump.01.Run).
  5. Select the entire row corresponding to the orphaned tag. Right-click → Delete Row, or use the Configuration Tool ribbon's Delete Selected command.
  6. Click Save in the Configuration Tool ribbon. The tool writes the modified table back to the SQL configuration database with proper transaction handling and referential checks.
  7. Close Excel. Open WinCC Explorer and recompile the project via Project → Compile → All.
Recommendation: Prefer the Configuration Tool over direct SSMS editing for any production WinCC system. The tool performs the same internal validation as the WinCC Tag Management editor, avoids cascading referential errors, and writes changes as a single atomic SQL transaction.

Alternative Workaround: Rename Then Delete

If direct deletion remains blocked even through the Configuration Tool, a two-step workaround often succeeds and requires no database editing:

  1. Rename the orphaned tag to a valid scalar name (e.g., Orphaned_Tag_Old) using Tag Management or the Configuration Tool. This breaks the dotted-name structure reference inside MCPTVARIABLEDESC by rewriting VARIABLENAME to remove the structure interpretation.
  2. Delete the renamed tag normally through Tag Management — no error appears because the tag is now a scalar with no implicit parent structure.

This works because the rename operation rewrites the VARIABLENAME column to a form that no longer triggers structure-element interpretation. The original problem record is effectively overwritten.

WinCC Version-Specific Notes

WinCC Version Database Backend Default SQL Instance Configuration Tool Bitness Notes
WinCC V7.0 / V7.1 / V7.2 Microsoft SQL Server 2005 / 2008 WINCC 32-bit Office only Tag Management naming rules relaxed; dots more easily accepted
WinCC V7.3 / V7.4 Microsoft SQL Server 2008 R2 / 2012 WINCC 32-bit Office only Improved tag validation, but legacy projects may still exhibit the bug
WinCC V7.5 / V7.5 SP1 Microsoft SQL Server 2014 / 2016 WINCC 32-bit Office only Tighter character validation; structure error less frequent
WinCC V8.0 (TIA Portal) Microsoft SQL Server 2016 / 2019 WINCCPLUS 64-bit Office Configuration Tool available as TIA option
WinCC Unified (PC) Microsoft SQL Server 2019 WINCCPLUS 64-bit Office Different database schema (PostgreSQL option for distributed); tag editing mostly via TIA Portal

For WinCC Unified systems, tag management is performed inside TIA Portal rather than the WinCC Configuration Tool add-on. If an invalid dotted tag is created in WinCC Unified, the recovery path is to delete the tag via TIA Portal → PLC tag table or HMI tag table, recompile, and download to the runtime.

Multi-User Engineering Scenarios

On multi-user engineering workstations, the corrupted tag may be locked by an active project session even after WinCC Runtime is stopped. To prevent this:

  1. Disable the WinCC project sharing via SIMATIC Manager → Project → Remote → Disable Remote Access or by stopping the CCEngineering service.
  2. Verify no engineering client has the project open by checking for a .lock file in the project folder.
  3. If a .lock file is present and the original client is unreachable, delete the .lock file only after confirming no concurrent write activity.

Prevention: Tag Naming Standards

Tag naming should follow IEC 61131-3 conventions and the WinCC naming rules enforced by the editor. A robust standard looks like:

Convention Recommended Form Forbidden Characters
Area_Equipment_Attribute Tank01_Level_PV Dot (.), space ( ), hyphen-minus (-), slash (/), backslash (\)
Site_Area_Equipment_Signal Plant1_Filler01_Valve_Cmd National characters (ä, ö, ü, ñ, ç), punctuation
Unit_Function_State Reactor2_Heater_On Reserved keywords (TRUE, FALSE, BOOL, INT)

Enforce the standard through a project-specific Excel template that is the only authorized method for tag creation. The template is consumed by the WinCC Configuration Tool, which validates names against the standard before any commit to the SQL database.

Verification After Recovery

  1. Open WinCC Explorer. Launch Tag Management and confirm the orphaned tag no longer appears in the tag list. Confirm no phantom structure rows appear in Project → Structure.
  2. Open the WinCC project in Graphics Designer and search every .pdl file for any dynamic reference to the old tag name. Replace references with the corrected tag where necessary. Use Tools → Cross Reference to identify all consumers.
  3. Recompile the project: Project → Compile → All. Confirm zero errors and zero warnings in the output window.
  4. Start WinCC Runtime in test mode. Open WinCC Tag Simulator (Tools menu) and verify all retained tags function. Trigger any alarm associated with the affected area to confirm the alarm system is intact.
  5. Run a SQL consistency check:
    -- Verify no orphan structure references remain
    SELECT COUNT(*) AS OrphanCount
    FROM dbo.MCPTVARIABLEDESC
    WHERE VARIABLENAME LIKE '%.%'
      AND STRUCTUREID NOT IN (SELECT STRUCTUREID FROM dbo.MCPSTRUCTURE);
    The result should be zero.
  6. Document the change in the project's revision log, including the original corrupted tag name, the recovery method used, the operator who performed it, and the verification evidence.

Troubleshooting Matrix

Symptom Likely Cause Resolution
"Selected object is a structure element" error on tag deletion Tag name contains a dot and is registered as a structure child Use Method 1 (SSMS) or Method 2 (Configuration Tool)
SSMS DELETE blocked by foreign-key constraint Tag referenced by an alarm, archive, or script Delete dependent records first; verify with the identification query
Tag reappears after WinCC Runtime restart Configuration database was edited but runtime cache not refreshed Stop all WinCC services, restart SQL Server, then restart WinCC
Configuration Tool ribbon missing Excel bitness mismatch or COM add-in not registered Reinstall matching bitness; confirm COM add-in enabled in Excel Trust Center
"Access denied" on SSMS connect Insufficient SQL rights for the engineering account Use the SA account or grant db_owner to the engineer account
Project fails to compile after recovery Dependent row deleted incorrectly, leaving a dangling reference Restore project from backup; redo the recovery with referential checks
Configuration Tool refuses to save the Excel changes Project currently open on another engineering workstation Close the project on all clients, then retry the save
Tag still present in runtime after config cleanup Runtime has cached the tag in dbo.MCPDATA Recompile and reload runtime; do not edit MCPDATA

Frequently Asked Questions

What characters are forbidden in WinCC tag names?

WinCC tag names cannot contain dots (.), spaces, hyphens, slashes, backslashes, or special national characters (ä, ö, ü, ñ, ç, etc.). Only A–Z, a–z, 0–9, and the underscore (_) are guaranteed safe. The dot is reserved as the structure-element separator for hierarchical tag paths.

Can I delete a structure tag through the WinCC Tag Management editor?

Only if it has no registered child elements. If the structure has any sub-tags — including implicit orphans from a dotted-name tag — the editor returns the "structure element" error and you must use the WinCC Configuration Tool or direct SQL manipulation to remove the children first.

Is editing the dbo.MCPTVARIABLEDESC table supported by Siemens?

No. Siemens officially supports tag management through the WinCC Tag Management editor and the WinCC Configuration Tool. Direct SQL editing is a field-engineer workaround documented in support forums and may invalidate support agreements if it causes project corruption.

What is the difference between the WinCC configuration and runtime databases?

The configuration database (named <Project>) stores static project definitions — tags, alarms, structures, scripts, archive configurations. The runtime database (named <Project>_R) holds live process values, archived measurements, and user logs. Tag deletion must always be performed on the configuration database, never on the runtime database.

How do I install the WinCC Configuration Tool?

The tool ships on the WinCC installation DVD. Run Setup.exe, choose Custom Installation, and enable Configuration Tool under WinCC Options. It registers as a Microsoft Excel COM add-in and requires the matching Excel bitness — 32-bit Office for WinCC V7.x, 64-bit Office for WinCC V8 (TIA Portal) and WinCC Unified.

Does the recovery procedure apply to WinCC Unified?

Not directly. WinCC Unified is engineered inside TIA Portal and uses a different database schema. If an invalid dotted tag is created in WinCC Unified, delete the tag via TIA Portal → HMI tag table, recompile, and download to the runtime. SSMS editing of WinCC Unified tables requires additional caution and is not generally recommended.

Back to blog