When I use ADD can I choose position in columns where it will be adding? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

When I use ADD can I choose position in columns where it will be adding?

10th Mar 2016, 10:27 AM
Shchokin Artem
Shchokin Artem - avatar
2 Réponses
+ 2
Depends on the RDBMS. Many require you to drop, recreate, and reload the table because the order of the columns may be leveraged in other places of the RDBMS (e.g. if it were used in a hashing algorithm to distribute table rows across a table using a unique key)
28th Nov 2016, 10:05 AM
ViceKnightTA
ViceKnightTA - avatar
+ 1
You can do that using the AFTER keyword, when using MySQL. For example: ALTER TABLE tablename ADD columnname INT AFTER anothercolumn But it wont work for MSSQL Server. For MSSQL Server you need to recreate the whole table.
26th May 2016, 12:56 PM
James Flanders