I am dropping a column 'aColumn' from very large SQL Server table and then re-creating that column with a constraint in the same table to populate this column with a default value. SQL server (2014) created that column at the same ordinal position in the table i.e between the same two columns it was there before it was dropped. I am using the following code. Can I supply this code to client who have to apply this code in production.
How can I be sure that this column will be created at the same ordinal position in production, else there will be a big problem in production.
ALTER TABLE aTable DROP COLUMN aColumn;
GO
ALTER TABLE aTable ADD aColumn [smallint] NOT NULL CONSTRAINT DF_aTable_aColumn DEFAULT (0)
GO
ALTER TABLE aTable DROP CONSTRAINT DF_aTable_aColumn
GO
ALTER TABLE aTable ALTER COLUMN aColumn [small int] NULL
GO