Reputation: 372264
I've been searching all afternoon for the way to re-order columns of an Azure database table in MS Visual Studio 2022. No luck.
In other applications columns are easily re-arranged by dragging or cut & paste.
No can do here. At this point, I'm not even sure columns can be moved in VS.
I'm only interested in the VS output view. I'm not interested in altering the database.
More specifically, I need two columns, which are on opposite ends of the table to be moved next to each other for a QA task. If this can't be done, I would have to jump or scroll from one end of the row to the other (across multiple screen views). If I can compare the columns next to each other, the task will take hours. If I can't, it will take weeks.
I guess another option would be to temporarily hide all the columns in between. That would be a less preferable but acceptable solution, as well.
Any guidance would be appreciated. Thank you.
Upvotes: 4
Views: 1441
Reputation: 11
If the table contains data, the easiest way to do this (in Azure Data Studio) would be to create the column by:
ALTER TABLE yourTable
ADD tableColumn dataType;
And then go to your table in your database, "design table", change the order and update.
This way the data would be kept in place and only the column would change its order.
This worked for me, at least. Hope this helps.
I don't know why there is not a simpler way to change the column order, but I guess it is because you can always SELECT the columns in the order needed.
Upvotes: 1
Reputation: 9818
If the table has no data in it then just replace it with one that has columns in the order you want.
If the table contains data then
Or create a view over the existing table and query the view rather than the table
Upvotes: 2