Im a bit new to T-SQL, Coming from a MySQL background Im still adapting to the different nuances in the syntax.
Im looking to add a new column AFTER a specific one. I’ve found out that AFTER is a valid keyword but I don’t think it’s the right one for the job.
ALTER TABLE [dbo].[InvStockStatus]
ADD [Abbreviation] [nvarchar](32) DEFAULT '' NOT NULL ;
This is my current query, which works well, except it adds the field at the end of the Table, Id prefer to add it after [Name]. What’s the syntax im looking for to represent this?
You can’t do it like that
for example if you have a table like this
and you want to add another column id2 between id1 and id3 then here is what SQL Server does behind the scene if you use the designer
As you can see if you have a lot of data this can be problematic, why does it matter where the column is located? just use