On 12/5/2011 1:19 AM, sd wrote:
> I'm writing a script that opens Excel files and does some formating of
> the content, but not to the headers. Therefore, I would like to be
> able to create column headers in sqlite with spaces in them. Such as
> "First Name" and also have column headers with characters such as / \
> #& etc.
>
> I've tried but keep getting all sorts of errors. Has anyone had to
> deal with this? Thanks!
For column names with spaces, I think surrounding the name with
double-quotes should work ("Column Name"). I'm not sure about the other
chars you mention.
That said, I wouldn't recommend using spaces (or special chars) as
you'll constantly be forced to deal with them in your code. Can you not
use an underscore char instead?
In my SQLite based apps, I always create simple table and column names
(no spaces or special chars), but also allow the User to create table
name aliases and column name aliases. So, if the end User doesn't like
seeing my raw table or column name in the app's table viewer, they can
define individual aliases as needed. If an alias exists for a table or
a column, it's presented in the GUI instead of the underlying name.
That way, my code isn't forced to deal with any special names, and yet
the User can create friendly names as they see fit. Seems to work well,
though it takes a bit of work to set up.
Jeff