I am running drupal 7 on SQL Server and IIS7. I am getting a syntax error and would like to know how to change the files' syntax so that I can use this module to export view data to CSV. I am a SQL Server DBA/Developer with limited knowledge of Drupal and this module. Any guidance/tips/code would be appreciated. tia.

Debug:

'Exception: SQLSTATE[42000]: [Microsoft][SQL Server Native Client 10.0][SQL Server]Incorrect syntax near the keyword \'SELECT\'.'

in views_data_export_plugin_query_default_batched->execute() (line 823 of C:\inetpub\wwwroot\dataentry\modules\views_data_export\plugins\views_data_export_plugin_display_export.inc).

PDOException: SQLSTATE[42S02]: [Microsoft][SQL Server Native Client 10.0][SQL Server]Invalid object name 'views_data_export_index_5'.: SELECT COUNT(*) FROM {views_data_export_index_5}; Array ( ) in views_data_export_plugin_display_export->execute_initial() (line 248 of C:\inetpub\wwwroot\dataentry\modules\views_data_export\plugins\views_data_export_plugin_display_export.inc).

Comments

trapper-1’s picture

Title: SQL Server support » PAID - SQL Server support
Component: Miscellaneous » Code
Category: feature » support

update to this post - I am willing to pay for help to get this working with SQL Server. If this is not the place to post for paid help, please advise where I can get someone to do this for some money.

trapper-1’s picture

Status: Active » Fixed

update - for anyone else reading this in the future having similar problems - all I needed to do was turn off the 'batched' property. also, for reference, the export has it's own 'pager' property which does not coincide with the view that you attach the export to.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

otolithe’s picture

Version: 7.x-3.0-beta5 » 7.x-3.0-beta6
Priority: Normal » Critical
Status: Closed (fixed) » Active

I'm having the exact same issue here, on a LAMP system:
Error message is:

Debug:
'Exception: SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default value for \'record2_vessels_authorizedfrom\''
in views_data_export_plugin_query_default_batched->execute() (line 841 of /var/www/vhosts/iotc.org/httpdocs/sites/all/modules/views_data_export/plugins/views_data_export_plugin_display_export.inc).

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'iotc.views_data_export_index_8' doesn't exist: SELECT COUNT(*) FROM {views_data_export_index_8}; Array ( ) in views_data_export_plugin_display_export->execute_initial() (line 264 of /var/www/vhosts/iotc.org/httpdocs/sites/all/modules/views_data_export/plugins/views_data_export_plugin_display_export.inc).

When batch export is activated... I'm running 7.x-3.0-beta6 but it fails also with 7.x-3.0-dev.

I'm running Drupal 7.12, Views 7.x-3.2 and ctools 7.x-1.2

Seems like the module can't create the required MySQL table view...
Any help would be appreciated.

steven jones’s picture

Status: Active » Closed (fixed)

This is not the same issue.

dobe’s picture

Title: PAID - SQL Server support » SQL Server support
Project: Views data export » Drupal driver for SQL Server and SQL Azure
Version: 7.x-3.0-beta6 » 7.x-1.x-dev
Category: Support request » Bug report
Priority: Critical » Normal
Issue summary: View changes
Status: Closed (fixed) » Active

This is not fixed. I am guessing it has to do with the SQL driver module. I am going to move over there as I just ran into this. I believe that what is going on is views data export is creating a temp table that the sql driver is not playing nicely with? Maybe I am wrong.

I will try with the 2.x version to see if that resolves it.

david_garcia’s picture

This totally looks like temp table not created.

This was fixed in 7.x-2.x, temporary table support was completely broken in 7.x-1.x.

Support for temporary tables was added in this commit:

http://cgit.drupalcode.org/sqlsrv/commit/?id=8084e74

This is the issue about it

#1860152: Support for temporary tables is broken

dobe’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
Issue summary: View changes

Ok so I think I finally setup an environment that runs 2.x. I was having some issues with not having ODBC 11 installed.

So I have the latest 7.x-2.x version enabled.

PHP 5.6.9
MS SQL Server PDO extension 3.2.0.0

I am still getting the same error though.

PDOException: SQLSTATE[42S02]: [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Invalid object name 'views_data_export_index_13'.: SELECT COUNT(*) FROM views_data_export_index_13; Array ( ) in views_data_export_plugin_display_export->execute_initial() (line 301 of C:\inetpub\wwwroot\drupal\sites\all\modules\contrib\views_data_export\plugins\views_data_export_plugin_display_export.inc).

and

User notice:
'Exception: SQLSTATE[42000]: [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Incorrect syntax near the keyword \'SELECT\'.'
in views_data_export_plugin_query_default_batched->execute() (line 899 of C:\inetpub\wwwroot\drupal\sites\all\modules\contrib\views_data_export\plugins\views_data_export_plugin_display_export.inc).

david_garcia’s picture

Would need to take a closer look, but probably this is failing:

        $query->preExecute();
        $args = $query->getArguments();
        $insert_query = 'CREATE TABLE {' . $display_handler->index_tablename() . '} SELECT @row := @row + 1 AS ' . $display_handler->batched_execution_state->sandbox['weight_field_alias'] . ', ' . implode(', ', $select_aliases) . ' FROM (' . (string)$query . ') AS cl, (SELECT @row := 0) AS r';
        db_query($insert_query, $args);
dobe’s picture

Your prolly right, it is probably the SELECT implementation.

david_garcia’s picture

Yes it was, a long time ago indeed:

#2015361: SQL Server Compatibility

david_garcia’s picture

Status: Active » Closed (won't fix)

There's nothing that can be done for this at the database driver level. The module is manually issuing a very MySQL specific query.

If anything is to be done, it's in the contrib that builds this query.