Site Export: SqlException: Conversion failed

Marcel Guldemond asked on January 26, 2016 14:55

We're trying to synch our dev and staging instances, but we haven't set up the servers to synch with each other yet, so we're trying to use export and import to synch them up.

The client's been adding content to staging while we've been modifying code on dev, and now we need to synch the two instances.

We reduced the export to just Pages, but this error still happens:

Message: Conversion failed when converting from a character string to uniqueidentifier.

Exception type: System.Data.SqlClient.SqlException Stack Trace: at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at System.Data.SqlClient.SqlDataReader.TryHasMoreRows(Boolean& moreRows) at System.Data.SqlClient.SqlDataReader.TryReadInternal(Boolean setTimeout, Boolean& more) at System.Data.SqlClient.SqlDataReader.Read() at System.Data.Common.DataAdapter.FillLoadDataRow(SchemaMapping mapping) at System.Data.Common.DataAdapter.FillFromReader(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue) at System.Data.Common.DataAdapter.Fill(DataSet dataSet, String srcTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords) at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) at CMS.DataEngine.AbstractDataConnection.ExecuteQuery(String queryText, QueryDataParameters queryParams, QueryTypeEnum queryType, Boolean requiresTransaction)

Exporting Pages Preparing export

We're using v9.0, but the site was originally created with v8.2

thanks, Marcel

Recent Answers


Martin Hejtmanek answered on January 26, 2016 16:25

Hi, this error is thrown during export, right?

My wild guess that you are either using a custom query with a custom view in some of the page types, or View_CMS_Tree_Joined is out of sync.

Try to review and refresh this view and your potential custom views if you have any.

If none of this helps, try to provide some more information, ideally more detailed stack trace from event log if available.

0 votesVote for this answer Mark as a Correct answer

Marcel Guldemond answered on January 26, 2016 17:35 (last edited on January 26, 2016 17:43)

Yes, this error is thrown during Export.

I've tried to isolate it by deselecting all, then just adding some specific objects. Exports work with just webparts, or just page templates, or just stylesheets, but if I select just Pages, then it throws the error.

Refreshing View_CMS_Tree_Joined doesn't seem to help, but we do have a couple of custom Views used in the page types. However, we didn't manually write those views, they were generated by the portal app.

Here's the query for the view:

SELECT CMS_Category.CategoryDisplayName AS CategoryDisplayName, CMS_Category_Parents.CategoryDisplayName AS ParentCategoryDisplayName FROM CMS_Category LEFT OUTER JOIN CMS_Category AS CMS_Category_Parents ON CMS_Category.CategoryParentID = CMS_Category_Parents.CategoryID

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on January 29, 2016 15:15

We have been solving this issue through the support channel. It looks like that there were two page types which have field named in the same way, but the field type (data type) is different (e.g. one was text and second GUID).

Just for future reference - best practice is to use unique field code names, best with the page type name as prefix.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.