
Editorial illustration.
Originally published 16 June 2023; rewritten and reviewed on 15 October 2026.
After upgrading a client project from Kentico 8.2 to Kentico 12, the site initially looked completely healthy. The homepage loaded, navigation menus worked, existing pages rendered without errors, and public form submissions went through fine. The failure only surfaced days later when I opened the Forms application, added a new column to an existing BizForm, and clicked Save.
Kentico threw an exception complaining that the SQL type datetime was not registered and referenced RegisterDataTypes. That single save action changed how I write upgrade checklists: browsing existing content does not exercise the administrative code paths that inspect and alter database definitions.
Follow the operation that failed
Public page views mostly run SELECT queries against CMS_Document, View_CMS_Tree_Joined, and cached repeaters. They never ask Kentico’s TableManager or DataTypeManager to parse a custom form table’s existing schema and rebuild it.
When I traced the stack down to the field-definition and table-structure code, the culprit was straightforward. In this particular upgraded database, the system columns FormInserted and FormUpdated on the underlying Form_* table were still typed as legacy SQL datetime, whereas Kentico 12 expected datetime2. When the form builder tried to read the table metadata to add the new column, the older datetime column tripped the data-type lookup.
That was the specific cause in this project, though you should never assume every exception with the same message has the identical root cause without inspecting your own table schema first.
Rehearse the schema change before production
Before touching a live database, take a fresh backup and verify you can actually restore it. Reproduce the form-edit failure on a staging copy, then inspect the real column types and default constraints in SQL Server rather than guessing names:
SELECT
c.name AS ColumnName,
t.name AS DataType,
dc.name AS DefaultConstraintName,
dc.definition AS DefaultDefinition
FROM sys.columns c
JOIN sys.types t ON c.user_type_id = t.user_type_id
LEFT JOIN sys.default_constraints dc ON c.default_object_id = dc.object_id
WHERE c.object_id = OBJECT_ID('dbo.Form_YourFormTableName')
AND c.name IN ('FormInserted', 'FormUpdated');
In SQL Server, you cannot alter a column’s data type while a default constraint is attached to it—and those constraint names are often auto-generated (like DF__Form_Cont__FormI__3A81B327). That is why a generic ALTER TABLE snippet copied from a forum post fails halfway through.
Once you have the exact constraint names and verify there are no dependent indexes or computed columns on those fields, you can drop the default constraint, alter the column to datetime2(7) with matching nullability, and re-attach the default inside a transaction:
BEGIN TRANSACTION;
ALTER TABLE dbo.Form_YourFormTableName
DROP CONSTRAINT DF__ReplaceWithActualConstraintName;
ALTER TABLE dbo.Form_YourFormTableName
ALTER COLUMN FormInserted datetime2(7) NOT NULL;
ALTER TABLE dbo.Form_YourFormTableName
ADD CONSTRAINT DF_Form_YourFormTableName_FormInserted
DEFAULT (GETDATE()) FOR FormInserted;
COMMIT TRANSACTION;
Always check Kentico’s official upgrade notes and confirm the script with whoever owns the database before running it on production.
Extend the upgrade acceptance test
After applying the fix on staging, re-run the exact operation that failed: open the BizForm, add a test field, save it, submit a new entry from the public page, and verify both old and new submissions appear cleanly in the Recorded Data tab.
The lasting lesson from that Kentico 8.2-to-12 upgrade is to put administrative writes into your post-upgrade smoke test. Creating a page, editing a form schema, uploading an item to the media library, and triggering a scheduled task will catch lingering schema mismatches long before an editor stumbles onto them in production.