Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

How can I export survey responses directly from SQLserver?

  • ldhf5237
  • ldhf5237's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
11 years 4 weeks ago #93961 by ldhf5237
:(
As we know data extraction from Lime Survey is limited. Now I got a requirement from business users to export data from SQLServer directly by running a SQL code. But when I queried in database I found some languages are stored as strange codes in database. How could I export the responses correctly without strange codes?

Many thanks in advance.
The topic has been locked.
  • Mazi
  • Mazi's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
11 years 4 weeks ago #93966 by Mazi
You are not the only one having tried to export data directly via an SQL statement and so far no one has succeeded to do so.
There are several reasons for this, e.g. Limesurvey stores answer codes instead of the full text answers to deal with multi-lingual surveys and thus several sub-queries are needed to get in all in line.
You definitely need a PHP script to do the export the data (and write it into another DB).

Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
The following user(s) said Thank You: ldhf5237
The topic has been locked.
More
6 years 1 week ago #167176 by tzedan
I know this topic is old but I reverse engineered the PHP code for getting the answer and created a stored procedure. I have attached my code.
The following user(s) said Thank You: Microchip
The topic has been locked.
  • Mazi
  • Mazi's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
6 years 6 days ago #167207 by Mazi
Thanks for sharing!

Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
The topic has been locked.
  • LouisGac
  • LouisGac's Avatar
  • Visitor
  • Visitor
6 years 6 days ago #167210 by LouisGac
that SQL code ^^
thank you for sharing, you could even create a wiki page for that.
The topic has been locked.
More
4 years 1 week ago #196726 by chromagic
By any chance would you have an updated version of your SQL stored procedure? When I execute it is giving me some errors creating the temp table, but I think it could be because I have a newer LimeSurvey Version 3.21.0+191203

For example,
exec [dbo].[p_CreateFieldMap] '621959'

(1 row(s) affected)

(1 row(s) affected)

(1 row(s) affected)
Msg 207, Level 16, State 1, Line 1
Invalid column name '621959X1X22SQ001'.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose