On 2018/08/01 5:29 PM, Charles Leifer wrote:
You can simply use:PRAGMA table_info('my_table') To get a list of columns, which you can check against and then conditionally add your column.
Aye, but during a script in SQL-only you don't have that luxury. One could also use a similar pragma to check if a table exists before creating it, but the SQL for: CREATE TABLE IF NOT EXISTS... makes it possible to add things without failing mid-script with no programmatic help (and to be blunt, much easier and nicer).
That said, I never add columns this way - but that might only be precisely because its IF NOT EXISTS does not exist. So...
+1 _______________________________________________ sqlite-users mailing list [email protected] http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

