Summary
In certain Laserfiche 9.1 repositories that were previously upgraded from Laserfiche 7, you may receive the following error when opening a document that contains annotations:
Failed to load annotations. The image cannot be modified.
General database error. [9008]
Cause
In Laserfiche 7, Laserfiche did not store the creator of an annotation. During the initial Laserfiche 7 to Laserfiche 8/9 database migration process, the Migration Utility may improperly create the placeholder value.
Resolution
Use the following SQL script to trim the offending fields. Stop the Laserfiche Server service before running the script.
Warning: Before modifying your Laserfiche database, make sure that you have a valid backup and understand how to restore the database if a problem occurs.
Download the following zip file containing the .sql script file.
The script contains the following SQL statements.
DECLARE @tblname sysname
DECLARE @colname sysname
DECLARE @stmt nvarchar(500)
DECLARE sidcol_cursor CURSOR FOR
SELECT c.TABLE_NAME, COLUMN_NAME
FROM INFORMATION_SCHEMA.COLUMNS c JOIN INFORMATION_SCHEMA.TABLES t ON c.TABLE_NAME = t.TABLE_NAME
WHERE DATA_TYPE = 'varbinary' AND CHARACTER_OCTET_LENGTH = 85
AND t.TABLE_TYPE = 'BASE TABLE'
OPEN sidcol_cursor
FETCH NEXT FROM sidcol_cursor
INTO @tblname, @colname
WHILE @@FETCH_STATUS = 0
BEGIN
SET @stmt = 'UPDATE ' + @tblname + ' SET ' + @colname + ' = SUBSTRING(' + @colname + ', 1, 68)'
EXEC sp_executesql @stmt
PRINT @stmt
FETCH NEXT FROM sidcol_cursor
INTO @tblname, @colname
END
CLOSE sidcol_cursor
DEALLOCATE sidcol_cursor
GO
Note: The sample SQL listed above will modify all columns in the database of type varbinary(85). Be aware that if you have added custom tables with columns of this type to the Laserfiche database that they will also be modified.