Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ALTER TABLE my_table ADD COLUMN column_name VARCHAR(50) AFTER col_name not supported in SQL Server 2000

I tried the following query in SQL Server 2000 so that I could add a new column after mentioned column.

alter table abc ADD dad varchar(50) after parentname

But it throws me the following error message

Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near 'after'.

Is there any way to do this in SQL Server 2000?

like image 608
Brainser Avatar asked Mar 10 '13 07:03

Brainser


People also ask

How do I add a column to a SQL Server after a particular column?

In Microsoft SQL Server, we can change the order of the columns and can add a new column by using ALTER command. ALTER TABLE is used to add, delete/drop or modify columns in the existing table. It is also used to add and drop various constraints on the existing table.

How can increase varchar column size in SQL Server?

You can use the ALTER table command to change the length of a varchar column. You can increase the length of a varchar column to a maximum size of 64,000.

How add varchar column in SQL?

For example: ALTER TABLE employees ADD last_name VARCHAR(50), first_name VARCHAR(40); This SQL Server ALTER TABLE example will add two columns, last_name as a VARCHAR(50) field and first_name as a VARCHAR(40) field to the employees table.

How do I add a column to a table at a specific position in SQL Server?

To add a column at a specific position within a table row, use FIRST or AFTER col_name . The default is to add the column last. You can also use FIRST and AFTER in CHANGE or MODIFY operations to reorder columns within a table.


1 Answers

In SQL Server there is no syntax such.

Just use

ALTER TABLE abc ADD dad varchar(50)
like image 120
pinaldave Avatar answered Oct 12 '22 13:10

pinaldave