On 8 Feb 2020, at 6:25pm, Andy KU7T <k...@ku7t.org> wrote:

> IF isnull(version) THEN
> -- create table, indexes etc.
> 
> ELSE
> -- make incremental changes
> 
> END IF

You're going to have to give up the idea that you can do all this in one 
complicated SQL command.  You're going to end up doing a lot of

1) use your software to execute SQL command
2) use your software to check the result and decide what to do

For instance you can't do the enclosing if checking the version number.  You 
have to do that in your software.

There is a form of of CREATE TABLE which goes

CREATE TABLE IF NOT EXISTS …

which might help.  Also SQL does have an 'IF' construction, but can't be used 
to make different changes, it is used to return different values.  Look for 
"The CASE expression" on this page:

<https://sqlite.org/lang_expr.html>
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to