Conversion failed when converting from a character string to uniqueidentifier.
This article describes the cause of the error as well as the solution.
You may face this error when exporting/importing a site or when working with web parts / widgets that list more than one page type. The full error contains an SQL query that joins all the page types in question, for example, like this eventdetails.txt.
This error is caused by at least two different page types (for example A and B) having a field named in the same way (for example FieldName) but in each page type the field data is stored as a different data type (for example for A it is 'Text' and for B it is 'GUID').
The best practice in this case is to use the page type code name as the Field name prefix. For example:
CustomPageTypeA_FieldName
How to find which fields in which page types are causing this conflict?
Update: new module "Page type fields data type mismatch" is available in the Kinspector since v3.3.0 that detects this mismatch (sample screen shot).
Executing this SQL query over your Kentico database you will get the list of field names and their count. This sample query is checking page types tables with prefix custom_ only and excluding custom tables. In the results, we are interested in those fields which count is higher than 1:
Copy the fields with countX > 2 and paste them into the second SQL query's WHERE condition. This query is slightly modified to return the page type coupled data table and also data type of given fields:
As you can see in the image above, the title field is OK – the data type in both cases is the same. However, the teaserimage field has different data type. One is nvarchar (text field) and second is unique identifier (GUID field). From the query result you can see in which page types’ tables is this field defined so you can either rename the field or change its data type in the admin UI to fix the error.
Applies to Kentico 8.x and newer