View Issue Details

This bug affects 1 person(s).
IDProjectCategoryView StatusLast Update
15829Bug reports_ Unknownpublic2020-03-05 08:00
ReporterCarmIT Assigned Toc_schmitz  
Status closedResolutionfixed 
Product Version4.1.0 
Fixed in Version4.1.9 
Summary15829: Upgrade from 3.21 to 4.1 - upgrade Database error (MSSQL)
DescriptionHello Support Team,

after an update from v3.21 to 4.1, no connection to the SQL server could be established. The following error message is displayed:

An non-recoverable error happened during the update. Error details:
CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Explicit value must be specified for identity column in table 'question_themes' either when IDENTITY_INSERT is set to ON or when a replication user is inserting into a NOT FOR REPLICATION identity column.
File C:\inetpub\wwwroot\limesurvey\application\helpers\update\updatedb_helper.php, line 2960.
Steps To ReproduceClick on "Start database upgrade" after which the error message was displayed
TagsNo tags attached.
Bug heat20
Complete LimeSurvey version number (& build)4.1.0
I will donate to the project if issue is resolvedNo
Database type & versionMSSQL
Server OS (if known)MSSQL 2008 Server
Webserver software & version (if known)IISv10
PHP Version7.3


has duplicate 15841 closedc_schmitz Incorrect dataset / identity insert property in SQL upgrade script on MSSQL DB engine for db object question_themes 

Users monitoring this issue

User List CarmIT, msvojsik




2020-02-06 14:00

administrator   ~55790

We need someone to test this on MSSQL.


2020-02-11 01:22

reporter   ~55848

I just found this bugreport, pls check my own duplicate bugreport for proposed solution:


2020-02-11 01:26

reporter   ~55849

For reference, the suggested solution copypasted


1. modify the updatedb_helper.php script to check the data in collection $baseQuestionThemeEntries & ensure this collection contains the primary key values as well (values for field 'id')


2. DO NOT use the MSSQL identity insert directive (line 2958 of the updatedb_helper) and let the DB engine add the primary key values on it's own.

You can NOT use the identity insert & ommit the values for primary key field/s at the same time.


2020-02-11 10:49

administrator   ~55852

> We need someone to test this on MSSQL.

There's a docker image with MSSQL on that can be used for testing on Linux machines:


2020-03-04 23:19

administrator   ~56302

Fix committed to master branch:

Related Changesets

LimeSurvey: master 4bd9487f

2020-03-04 23:19:00


Details Diff
Fixed issue 15829: Unable to upgrade from 3.x to 4x when using MSSQL Affected Issues
mod - application/helpers/update/updatedb_helper.php Diff File

Issue History

Date Modified Username Field Change
2020-02-06 12:07 CarmIT New Issue
2020-02-06 13:59 ollehar Summary Upgrade from 3.21 to 4.1 - upgrade Database error => Upgrade from 3.21 to 4.1 - upgrade Database error (MSSQL)
2020-02-06 14:00 ollehar Note Added: 55790
2020-02-06 14:15 ollehar Priority none => urgent
2020-02-11 01:22 msvojsik Note Added: 55848
2020-02-11 01:26 msvojsik Note Added: 55849
2020-02-11 01:26 msvojsik Issue Monitored: msvojsik
2020-02-11 10:49 ollehar Relationship added related to 15841
2020-02-11 10:49 ollehar Note Added: 55852
2020-03-04 23:18 c_schmitz Relationship replaced has duplicate 15841
2020-03-04 23:18 c_schmitz Issue Monitored: CarmIT
2020-03-04 23:18 c_schmitz Assigned To => c_schmitz
2020-03-04 23:18 c_schmitz Status new => assigned
2020-03-04 23:19 c_schmitz Changeset attached => LimeSurvey master 4bd9487f
2020-03-04 23:19 c_schmitz Note Added: 56302
2020-03-04 23:19 c_schmitz Resolution open => fixed
2020-03-04 23:19 c_schmitz Status assigned => resolved
2020-03-04 23:19 c_schmitz Fixed in Version => 4.1.9
2020-03-05 08:00 CarmIT Status resolved => closed