Create SQL table as copy of an existing table (ODBC and C#)
Using ODBC to manipulate an Access database in C#.
All of the following do NOT create the table. Each generates the exception Syntax error in CREATE TABLE statement.:
sqlQuery = "CREATE TABLE SpecialScans AS (SELECT * FROM Scans);"
sqlQuery = "CREATE TABLE [SpecialScans] AS (SELECT * FROM [Scans]);"
sqlQuery = "CREATE TABLE [SpecialScans] AS SELECT * FROM [Scans];"
// And all of the above with " WHERE 1=2;" to create just the schema
This follows the syntax specified on the w3schools website and elsewhere.
But the syntax given in the accepted answer on this question works fine:
sqlQuery = "SELECT * INTO [SpecialScans] FROM [Scans];"
// And with " WHERE 1=2;" to create just the schema
Why does the former fail but the latter work?
from Recent Questions - Stack Overflow https://ift.tt/3umGnUT
https://ift.tt/eA8V8J
Comments
Post a Comment