Skip to content

CREATE TABLE AS SELECT not valid SQL for SQL Server #131

@jimhester

Description

@jimhester

This idiom is used frequently by DBItest, but is not valid for SQL Server, where one needs to use SELECT INTO instead. Not sure how is best to handle this but it restricts the number of tests I can turn on for the SQL Server Driver with odbc.

dbSendStatement(con, "CREATE TABLE test AS SELECT 1 as a")
#>  Error in eval(substitute(expr), envir, enclos) : 
#>   <SQL> 'CREATE TABLE test AS SELECT 1 as a'
#>   nanodbc.cpp:1587: 42000: [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Incorrect syntax near the keyword 'SELECT'.
dbSendStatement(con, "SELECT 1 AS a INTO test")
dbReadTable(con, "test")
#>   a
#> 1 1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions