T&B wrote:
Hi all,
I've just joined this mail list.
I've read through the syntax page and other sources as to how to
create a table using SQLite, and it's all working fine. But I can't
find any specifications for the format of a column name. Does the
spec permit spaces in the name? It seems to work OK when creating a
table if I enclose the column name in quotes, eg:
CREATE TABLE People('Name First', 'Name Last')
And getting the list of column names works fine. But select
statements don't seem to work if the column names have spaces.
So, are spaces allowed or not? Is there a specification somewhere
that shows what characters, length etc are allowed in column names
(and table names)?
It's an SQL thing, not an SQLite thing - if you must use spaces in
column names, put the column name in []. Same applies for column names
which are reserved words.
C:\>sqlite3 tom
Loading resources from C:\Documents and Settings\Martin/.sqliterc
SQLite version 3.3.6
Enter ".help" for instructions
sqlite> CREATE TABLE People('Name First', 'Name Last');
sqlite> insert into People values("Martin","Jenkins");
sqlite> select * from People;
Name First Name Last
---------- ----------
Martin Jenkins
sqlite> select 'name First' from People;
'name First'
------------
name First
sqlite> select [name First] from People;
Name First
----------
Martin
sqlite>
sqlite> select "made up name" from People;
"made up name"
--------------
made up name
sqlite>.q
HTH
Martin
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------