How can I export survey responses directly from SQLserver?

More
7 years 3 months 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.

Please Log in to join the conversation.

LimeSurvey Partners
More
7 years 3 months 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
Contact: marcel.minke(at)survey-consulting.com
Want to use your survey offline -> www.offlinesurveys.com
The following user(s) said Thank You: ldhf5237

Please Log in to join the conversation.

More
2 years 2 months 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.
Attachments:

Please Log in to join the conversation.

More
2 years 2 months ago #167207 by Mazi
Thanks for sharing!

Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com
Want to use your survey offline -> www.offlinesurveys.com

Please Log in to join the conversation.

  • LouisGac
  • LouisGac's Avatar
  • Visitor
  • Visitor
2 years 2 months ago #167210 by LouisGac
that SQL code ^^
thank you for sharing, you could even create a wiki page for that.

Please Log in to join the conversation.

More
2 months 3 weeks 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'.

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now