This is a simple problem. This is the same problem as changing the table in the table designer. I think you changed the column inside your spreadsheet design, which should drop and recreate the table to allow the column order in the same position.
Here is a brief example. Take this table design as indicated:
CREATE TABLE dbo.Test( id int identity(1,1), firstname nvarchar(100), name nvarchar(100), street nvarchar(100) )
This will create the columns in the specified order. You can see this order here:
SELECT name, column_id FROM sys.columns WHERE object_id = OBJECT_ID(N'dbo.Test')
You will see something like this:
column_name column_id id 1 firstname 2 name 3 street 4
If you change the name column through the constructor or in your case in the data project, this will force SQL Server to get this order upright. In this case, you will try to change the name column to lastname . This will ensure that SQL Management Studio and other similar programs run to keep column_id upright. This can only be done if the table is completely recreated with the correct column order. SQL Server creates a temporary stub for the table, inserts everything into it, discards the old table, and renames the temporary table to the old original name. As in your code above.
After that you will see something like this:
column_name column_id id 1 firstname 2 lastname 3 street 4
If you just rename the last column or do it manually, everything will be fine. Manually will be much more efficient since there is no need to move ALL data to a new table. The manual way would be the following:
This will result in the following result:
column_name column_id id 1 firstname 2 street 4 lastname 5
The latter will be much more effective, as already mentioned.
I hope this answers your question, even if the answer comes recently.