views:

17

answers:

1

Hello,

I'm developing an app which requires that the user selects a year formatted like this 1992-1993 from a spinner. The tablename is also named 1992-1993 and the idea is that using SQL the values from this table are pulled through with a statement like this select * from 1992-1993. When I run the emulator however, it throws an error.

If I then relabel the Spinner item to NinetyTwo and rename the table to NinetyTwo and run the emulator it runs as expected and the data is pulled through from the table.

Does SQLite have an issue with numbers in table names?

A: 

Yes and No. It has an issue with numbers at the beginning of a table name. 1992-1993 is an expression returning -1. Try to rename the table to Year1992.

Here a similar issue on SO.

eumiro
...or, put the table name in strings, like `"1992-1993"` or `\`1992-1993\`` or `'1992-1993'` (I'm not sure which SQLite uses).
Tim Čas
With SQLite you can use `"` or `[..]`.
Benoit
That's great. Thanks for taking the time to explain
Sumino7