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'm quite new to Oracle SQL (though I've written a fair bit of SQL)
I am new to SQL and been given a task. Following are the details:
I a bit new to sqllite lite and linux commands so any help would
I am very new to working with SQL queries. Any suggestions to improve this
I'm using an AutoCompleteExtender in ASP.NET/C# to retrieve data from my database, along with
Based on reading around the web, stack overflow, and mostly these articles about db
I'm guessing this is a matter of figuring out what oracle command to use,
hey guys m having this wierd exception of cast though my datatypes are correct
I'm attempting the modify this Modx Snippet so that it will accept multiple values
I am trying to update a set of queries using .NET's DataAdapter. Here's a

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.