C cwt Active Member Licensed User Longtime User Feb 27, 2012 #1 If I have an existing SQLite table that I have added a new column to how can I convert the old table to the new table definition without deleting the old table? Is there an example for this? Thanks
If I have an existing SQLite table that I have added a new column to how can I convert the old table to the new table definition without deleting the old table? Is there an example for this? Thanks
Erel B4X founder Staff member Licensed User Longtime User Feb 28, 2012 #2 You can use a query such as: ALTER TABLE table1 ADD COLUMN col1. See this link: SQLite Query Language: ALTER TABLE Upvote 0
You can use a query such as: ALTER TABLE table1 ADD COLUMN col1. See this link: SQLite Query Language: ALTER TABLE
H Hubert Brandel Active Member Licensed User Longtime User Nov 29, 2012 #3 Hi, i have to alter too and set the field to an default value. I did it this way: Code: sql1.ExecNonQuery("ALTER TABLE LG ADD COLUMN JobArt TEXT") sql1.ExecNonQuery("UPDATE LG SET JobArt = 'HA' ") But is there a way to set the 'HA' in the 'ALTER TABLE' line too ? Regards, Hubert Upvote 0
Hi, i have to alter too and set the field to an default value. I did it this way: Code: sql1.ExecNonQuery("ALTER TABLE LG ADD COLUMN JobArt TEXT") sql1.ExecNonQuery("UPDATE LG SET JobArt = 'HA' ") But is there a way to set the 'HA' in the 'ALTER TABLE' line too ? Regards, Hubert
mc73 Well-Known Member Licensed User Longtime User Nov 29, 2012 #4 You can write this at the end of your alter query: Code: DEFAULT 'HA' Upvote 0
H Hubert Brandel Active Member Licensed User Longtime User Nov 29, 2012 #5 Thanks :sign0098: Upvote 0