Hi Richard,

Richard Boyd wrote:

Thanks for the prompt reply...

I tried what you suggested and I always get the error message:
"SQL error: no such column: table32"
Whether the table exists or not, I always get returned value of 1 from
sqlite3_exec().

The exact command that I use is:
SELECT count(*) FROM sqlite_master WHERE name=table32 AND type='table';

I also tried single quotes around the table32 name:
SELECT count(*) FROM sqlite_master WHERE name='table32' AND type='table';
And get no errors whether the table exists or not....

When I try the other method suggested ("SELECT NULL FROM sqlite_master WHERE
tbl_name = 'your-table';") I don’t get any error messages whether the table
exists or not. The return value is always 0.

I'm obviously missing where the error is being flagged, have you any more
pointers?
Sorry if I'm being dense here but I'm new to SQL databases.

Thanks again,
Richard.



SELECT COUNT(*) etc. should return a tuple with one column, not an error message. You then retrieve that tuple. If the value in the tuple is 0, then the table does not exist. If the value is 1, then it does exist.


HTH

Ulrik P.

--
Ulrik Petersen, MA, B.Sc.
University of Aalborg, Denmark
Homepage: http://ulrikp.org




Reply via email to