Do not do that. You will delete the table. Do this:
B4X:
If Sql1.ExecQuerySingleResult("SELECT count(name) FROM sqlite_master WHERE type='table' AND name ='yourTableName'") = 0 Then
msgbox("Does not exist","")
Else
msgbox("Table exists","")
End If
SQL1.ExecNonQuery("DROP TABLE IF EXISTS" & ayir2(0) & ")
with this line:
B4X:
SQL1.ExecNonQuery("DROP TABLE IF EXISTS " & ayir2(0))
Notice the space after EXISTS
EDIT: I forgot to mention also that you need a space here after TABLE like this: ("CREATE TABLE "
Also, you need a space after INTO like this: "INSERT INTO "
I'm trying to understand... You want to delete a table and recreate it, or you want to create it in case it doesn't exist? If it's the second, you should use
B4X:
create table if not exists yourTable (and so on...)
SQL1.ExecNonQuery("DROP TABLE IF EXISTS" & ayir2(0) & ")
with this line:
B4X:
SQL1.ExecNonQuery("DROP TABLE IF EXISTS " & ayir2(0))
Notice the space after EXISTS
EDIT: I forgot to mention also that you need a space here after TABLE like this: ("CREATE TABLE "
Also, you need a space after INTO like this: "INSERT INTO "
if(table_name.compareto(SQ.ExecQuerySingleResult("Select name From sqlite_master WHERE Type='table' AND name='"& table_name & "'"))==0)then
log("Table exist")
else
log("Table don't exist")
end if
if(table_name.compareto(SQ.ExecQuerySingleResult("Select name From sqlite_master WHERE Type='table' AND name='"& table_name & "'"))==0)then
log("Table exist")
else
log("Table don't exist")
end if