Summary:

The following issue may be logged to eWare system and SQL logs following an upgrade of Sage CRM:

execsql,time,sql,errormsg 1248 exec fixViewsMetadata
Transaction count after EXECUTE indicates a mismatching number of BEGIN and COMMIT statements. Previous count = 0, current count = 1

Symptoms:

This can be caused by errors in the existing views on the CRM database.

The process to fix it is to run the statement "exec sp_refreshview" for each view and fix any errors that occur.

Resolution:

A straightforward way of doing this is to run:

SELECT 'exec sp_refreshview ''' + name + '''' FROM sysobjects
WHERE UPPER(xtype) = 'V'
order by name asc

Copy the results of this statement into a Management Studio query pane. Execute these statements in batches of 10 or 15 deleting them if they complete
successfully.

This should leave you with the erroneous views that you need to fix or drop.

Typically, views may reference fields or objects that have been dropped in the product (e.g. pers_emailaddress) - these can usually be fixed by referencing the updated views containing aliased versions of these fields, such as vPersonPE and vCompanyPE instead of the Person and Company tables.