rishabh wrote: > i have a stream of data coming in with constant table names and data. > one of the table names contains a '-' (minus sign). it gives error > while creating the table. > > SQL error: near "-": syntax error > something like Create table "t-t" ( a ); works but Create table t-t ( > a ); gives the above error.
t-t is not a valid identifier. If you insist on naming your table (or column, or view, or trigger) this way, you must enclose the name in quotes. > similarly insert into "t-t" values (1); works, but dont know why using > mprintf it has a problem. :( What problem? How do you use mprintf? Show some code. > if i use double quotes around the table name, the table gets created, > but then insert on that table does not work. Show your insert statement. Define "doesn't work". > i am using C/C++ to do > the inserting, creating, updating etc. > if in mprintf ... i use \"%Q\" %Q adds a pair of apostrophes around the string. If you are using it for a table name, you end up with a statement like insert into "'t-t'" values (1); so the table name is 't-t' (including apostrophes), not t-t. > ... for the insert statement, it does > not it gives error saying that the table does not exist whereas the > table has been created. Table "t-t" has been created - but table "'t-t'" has not. Igor Tandetnik _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users