On 5 Dec 2012, at 2:33pm, Durga D <durga.d...@gmail.com> wrote: > I just want to find whether table exists or not in a database. > > > Is it correct query? > > > select distinct tbl_name from sqlite_master where tbl_name = 'abc';
This may return zero lines or many. Because indexes and other pieces of information for a table can have the same value in the 'tbl_name' column. So you can do this, but don't test to see if it returns 1 line, test to see if it returns zero lines. Or you can do SELECT name FROM sqlite_master WHERE tbl_name = 'abc' AND type='table' > Is there any other better way to find whether table exists or not. You can do PRAGMA table_info(table-name) and see what comes back. Can't check it now, but I think it gives an error if the table doesn't exist. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users