Add field in position I want in sql server

3

Whenever I make a ALTER TABLE and add a column, that field goes to the end.

In design mode, using the graphical tool of Sql Management, there is the option of Insert Column in any position, but it happens that I can not save.

I have permission from the bank's Admistrator. How do I, if there is a way, to include in an existing table, including with data, to put this new field in the position I want?

    
asked by anonymous 30.01.2015 / 12:12

2 answers

3

As already mentioned, this type of change requires that the table be re-created. You need to authorize Management Studio to do this:

ImageSource: link

    
30.01.2015 / 14:53
1

Normally, the error appears when you try to change the structure of a table that is already being used and has some reference, be it FK, Constraint, Index, etc ...

Below are two options that can be adopted:

  • If there is not a lot of data in your table, you can export, drop the current table, create the new table, edit the exported values, and insert the values in order with your new column together.

  • If you have many records in your table, I suggest you leave the column at the end of the table itself, it will not affect anything, it will not just display as easily, when you return a direct select in Management Studio

30.01.2015 / 13:08