Answer the question
In order to leave comments, you need to log in
How to add columns to the database on the fly?
All the best, I can’t understand, I have a MS SQL LocalDb database, I work with it using a pre-created model, during the program’s operation it is necessary to add a column to the table ... how to implement this correctly?
Answer the question
In order to leave comments, you need to log in
What do you mean by "on the fly"? Reaction to some user action? For 99.9% of cases - this behavior is not needed. It is necessary to revise the task a little and do it without adding columns. A DB - a thing in a high degree static has to be. Based on this, you can engage in its optimization of work.
Well, if you want to roll updates without stopping the application, then the banal ALTER TABLE should be enough for you.
It is correct not to do this with SQL database. In the sense - do not change the SQL schema of the database at the request of the user. You need to think about why such a need arises, perhaps some of the data needs to be stored in a document-oriented database.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question