Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 856995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T08:19:44+00:00 2026-05-15T08:19:44+00:00

Im a bit new to T-SQL, Coming from a MySQL background Im still adapting

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T08:19:45+00:00Added an answer on May 15, 2026 at 8:19 am

    You can’t do it like that

    for example if you have a table like this

    create table TestTable(id1 int,id3 int)
    

    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

    BEGIN TRANSACTION
    SET QUOTED_IDENTIFIER ON
    SET ARITHABORT ON
    SET NUMERIC_ROUNDABORT OFF
    SET CONCAT_NULL_YIELDS_NULL ON
    SET ANSI_NULLS ON
    SET ANSI_PADDING ON
    SET ANSI_WARNINGS ON
    COMMIT
    BEGIN TRANSACTION
    GO
    CREATE TABLE dbo.Tmp_TestTable
        (
        id1 int NULL,
        id2 int NULL,
        id3 int NULL
        )  ON [PRIMARY]
    GO
    ALTER TABLE dbo.Tmp_TestTable SET (LOCK_ESCALATION = TABLE)
    GO
    IF EXISTS(SELECT * FROM dbo.TestTable)
         EXEC('INSERT INTO dbo.Tmp_TestTable (id1, id3)
            SELECT id1, id3 FROM dbo.TestTable WITH (HOLDLOCK TABLOCKX)')
    GO
    DROP TABLE dbo.TestTable
    GO
    EXECUTE sp_rename N'dbo.Tmp_TestTable', N'TestTable', 'OBJECT' 
    GO
    COMMIT
    

    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

    select col1,col2,col3 from table
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am somewhat new to qt/c++ (coming from a php/sql world) and I am
I'm a bit new to SQL and have trouble constructing a select statement. I
I'm still a bit new to git, and I use gitg to visualize trees.
I am a bit new to sql and php so I need some help
Finding it a little bit tedious migrating to the new Mysql Workbench (5.2.22) even
I am looking into using the new SQL Server Express LocalDB (I think it
I'm a little bit new to PL/SQL and need something that looks a bit
I'm a bit new to ASP.NET. Actually, I'm a marginalized VB/SQL programmer who is
Looking for a bit of help with taking a dat from a DatePicker Widget
I'm brand new to SQL programming, and having a bit of trouble. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.