custom development in SharePoint’s sql database

Recently I visited a customer to do a SharePoint 2007 to 2013 upgrade.

Easy …

This customer created custom SQL views and SQL stored procedures in their database. I knew this was unsupported but all seemed to be working ok until we tried to upgrade their 2007 Environment to 2007 SP2.

It just didn’t want to work. Errors similar to the following appeared in the upgrade log:

[SPManager] [ERROR] [6/24/2013 3:42:47 PM]: Upgrade [SPContentDatabase Name=My_Content Parent=SPDatabaseServiceInstance] failed.
[SPManager] [ERROR] [6/24/2013 3:42:47 PM]: Invalid object name ‘dbo.MyCustomView’.
[SPManager] [ERROR] [6/24/2013 3:42:47 PM]: at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at Microsoft.SharePoint.Utilities.SqlSession.ExecuteNonQuery(SqlCommand command)
at Microsoft.SharePoint.Upgrade.SPSqlCommandFactory.GetRowCount(String strTable)
at Microsoft.SharePoint.Upgrade.SPDatabaseWssSequence.LogTableRowCounts()
at Microsoft.SharePoint.Upgrade.SPDatabaseWssSequence.PreUpgrade()
at Microsoft.SharePoint.Upgrade.SPContentDatabaseSequence.PreUpgrade()
at Microsoft.SharePoint.Upgrade.SPManager.Upgrade(Object o, Boolean bRecurse)

Looking at the upgrade.log (in 12/Logs) the problem was solved quickly.

The custom views and procedures didn’t use the dbo scheme. They used custom schemes. Sharepoint seems to collect all view names and then assumed the dbo scheme resulting in a view not found.

Painful for the customer. They had to delete all. Their custom views, procedures. Applications using the views/procedures failed and they had to realise that they had an unsupported SharePoint farm.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: