Alter table add column Sql Server

Alter table add column SQL Server


In this tutorial, I am going to tell, how you can add a column in the existing table. To add a new column in the table we use alter table tablename add the statement.




First Step 1:

CREATE TABLE employee  (

    emp_code varchar(100) not null

);

Suppose, you forget to add the column during the table creation, later on, you can alter the table and add a column with the data type.


alter table employee add address varchar(50) not null

alter table employee add empid bigint not null identity primary key

alter table employee add status char(1) null

 

In this tutorial, you see how you can add a column in the existing table. 

Note:
Add a column in the table doesn't affect the table


Also Read


Post a Comment

Post a Comment (0)

Previous Post Next Post