AS is a key word, so I believe you either have to put it in single or double
quotes to use it as a column name:

INSERT INTO [shopdata] (Date_TS, HS, "AS")...

Hopefully I'm remembering correctly what I've read in the past.

Eric Pankoke
Mobile Games Reviewer
My Site: http://www.rustysabre.com/
Reviews: http://www.technobrains.com/, http://www.touchmyapps.com
Blog: http://www.iphonelife.com/blogs/eric-pankoke
Twitter: http://www.twitter.com/RustySabre/
 

-----Original Message-----
From: sqlite-users-boun...@sqlite.org
[mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Account 69
Sent: Sunday, December 11, 2011 5:01 AM
To: sqlite-users@sqlite.org
Subject: [sqlite] Is a column name of 'AS' a restricted column name

Hello,

Just started to use SQLite3 instead of MSAccess within my programming 
environment can hit a problem. I have searched the mailing list and also 
other internet sites for help but could not find any.

In my table I have (for simplicity) 4 columns (ID, Date, HS, AS)
My data comes from an established hourly CSV file that I receive for the 
  last 7 years. In the past I would use VB6 to process the CSV and then 
via a SQL Insert statement I would insert into an MSAccess database (for 
local PC usage) and also a MySQL database (for internet usage)

The table is..
CREATE TABLE [shopdata] (
[ID] INTEGER PRIMARY KEY,
[Date_TS] INTEGER,
[HS] DOUBLE Default (0),
[AS] DOUBLE Default (0));

When I use the following SQL in my application

INSERT INTO [shopdata] (Date_TS, HS, AS) VALUES ('1012003200','15','9')

The insert fails with an error of (near "AS": syntax error)

This has had me stumped for a few days especially as I am getting to 
grips with SQLlite and kept thinking I am doing something wrong.

I messed around late last night and I changed the column name of "AS" to 
"A_S" and the inset works fine and the data is stored in the database. 
To recheck I had not changed the table structure in an other way I 
reverted back to using a column name of "AS" and again I got the SQL 
errors of (near "AS": syntax error)

I tried this also in SQLExpert and the exact same happens. In MSAccess 
and MySQL this column name of "AS" works fine (as has been for 7 years)

Is a column name of "AS" a restricted column name in SQLlite? Can anyone 
point me to a webpage that species these restricted column names or is 
this an error on my part somewhere

Thank you.

PS, I do not have control over the incoming CSV, so I have to make any 
changes during processing.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to