View Issue Details

This bug affects 1 person(s).
 4
IDProjectCategoryView StatusLast Update
03545Bug reportsStatisticspublic2009-08-12 20:57
Reporteruser4484Assigned Toc_schmitz  
PrioritynormalSeveritypartial_block 
Status closedResolutionfixed 
Product Version1.85+ 
Fixed in Version1.85+ 
Summary03545: MSSQL error when trying to View the statistics for this survey.
Description

Hi,
We're testing out an installation with a sql2005 backend.
I created a new survey, with 1 group and 1 question.
I set the "Public statistics?" value to yes.
Activated the survey.
Now, when I complete the survey and click on the link "View the statistics for this survey."
I get the following sql error

[Microsoft][ODBC SQL Server Driver][SQL Server]The data types text and varchar are incompatible in the equal to operator.:SELECT [questions].*, group_name, group_order FROM [questions], [groups], [question_attributes] WHERE [groups].gid=[questions].gid AND [groups].language='en' AND [questions].language='en' AND [questions].sid=74785 AND [questions].qid=[question_attributes].qid AND [question_attributes].attribute='public_statistics' AND [question_attributes].value='1'

the line that is giving the issue is "AND [question_attributes].value='1' "

TagsNo tags attached.
Attached Files
Bug heat4
Complete LimeSurvey version number (& build)7394
I will donate to the project if issue is resolved
BrowserFF 3.5, IE 7.0
Database type & versionMicrosoft Sql Server 2005, 2000
Server OS (if known)Windows Server 2003
Webserver software & version (if known)IIS 6.0
PHP VersionPHP 5.2.10

Users monitoring this issue

There are no users monitoring this issue.

Activities

user372

2009-08-07 15:01

  ~09044

I can test this issue, because I don't have MSSQL.
@ c_schmitz: can you please have a look at it? I can't reproduce the error on MySQL.

bobc55

bobc55

2009-08-07 19:11

reporter   ~09045

column value in table question_attributes is defined as a TEXT data type for both mysql and mssql.

In sql server, you can not use the equal (=) in a where clause with a TEXT data type. question_attributes.value='1' will produce an error with any version of mssql

quick fix

Option 1: Change data type
a) to find the default constraint name: sp_help question_attributes
b) alter table question_attributes drop constraint DF__question_valuexxxxxx (note the name will look something like this)
c) alter table question_attributes alter column value varchar(8000)

Option 2: reinstall with a change...
a) in the /admin/install/create-mssql.sql
b) find the table create statement CREATE TABLE [prefix_question_attributes]
c) change [value] TEXT default NULL to [value] varchar(8000) default NULL
d) reinstall

Option 3: change php code - replace = with like
change ...AND question_attributes.value='1'... to ...AND question_attributes.value like '1'...

Long term solution

change data type to varchar. What it the typical length needed? Looking at my database, I see only 3 chars being used.

Issue History

Date Modified Username Field Change
2009-08-07 14:57 user4484 New Issue
2009-08-07 14:57 user4484 Status new => assigned
2009-08-07 14:57 user4484 Assigned To => user372
2009-08-07 14:57 user4484 File Added: limesurvey_survey_74785.csv
2009-08-07 14:57 user4484 Build Number => 7394
2009-08-07 14:57 user4484 Browser => FF 3.5, IE 7.0
2009-08-07 14:57 user4484 Database & DB-Version => Microsoft Sql Server 2005, 2000
2009-08-07 14:57 user4484 Operating System (Server) => Windows Server 2003
2009-08-07 14:57 user4484 Webserver => IIS 6.0
2009-08-07 14:57 user4484 PHP Version => PHP 5.2.10
2009-08-07 14:57 user4484 Issue Monitored: user4484
2009-08-07 14:58 user372 Assigned To user372 => c_schmitz
2009-08-07 15:01 user372 Note Added: 09044
2009-08-07 19:11 bobc55 Note Added: 09045
2009-08-10 18:13 c_schmitz Status assigned => resolved
2009-08-10 18:13 c_schmitz Fixed in Version => 1.85+
2009-08-10 18:13 c_schmitz Resolution open => fixed
2009-08-12 20:57 c_schmitz Status resolved => closed