B4J Question Insert new column in SQLite-DB

strupp01

Active Member
Licensed User
Longtime User
I would like to insert a new column into my DB via B4J program. The new column should not be added at the back, but in the middle. I have applied the following command:

SQL_DB.ExecNonQuery("ALTER TABLE Angebot_Details ADD Rabatt_Proz Text AFTER 'Netto_Preis'")

Unfortunately, he adds the new column last. What is wrong ?
 

Daestrum

Expert
Licensed User
Longtime User
The command you tried will work on MySQL DB but not on SQLite DB.

You can specify the order you want the columns returned in a SELECT query (unless you use *).
 
Upvote 0

rboeck

Well-Known Member
Licensed User
Longtime User
I think, that the order of columns is not definable; but if this a problem for you, then you can create a view with columns in your wanted order or simple create the select statement like "Select Notte_Preis, Rabatt_Proz from..."
 
Upvote 0

strupp01

Active Member
Licensed User
Longtime User
That I can query the columns about the name is known to me. I just wanted to get some structure in my DB. So I'll have to take it that way.
Thank you for your answers.
 
Upvote 0

MarkusR

Well-Known Member
Licensed User
Longtime User
is seems also possible to move columns/fields up and down with the pc tool "DB Browser for SQLite"
 
Upvote 0
Top