R
R
Roman Zhidkov2016-02-15 15:47:04
C++ / C#
Roman Zhidkov, 2016-02-15 15:47:04

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

3 answer(s)
D
Dmitry Kovalsky, 2016-02-15
@dmitryKovalskiy

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.

S
Stanislav Makarov, 2016-02-15
@Nipheris

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 question

Ask a Question

731 491 924 answers to any question