sql alter table
snippet in sql

sql add column

user8146

ALTER TABLE Customers
ADD Email varchar(255);

add column sql

user3596


  ALTER TABLE Customers
ADD Email varchar(255);
 

append column sql

user3432

ALTER TABLE table_name
ADD column_name datatype;

--example
ALTER TABLE Customers
ADD Email varchar(255);

sql alter column size

user7890

ALTER TABLE table_name
ALTER COLUMN column_name datatype;

sql alter table

user6582

Adds, deletes or edits columns in a table. It can also be used to add and
delete constraints in a table, as per the above.
Example: Adds a new boolean column called ‘approved’ to a table named
‘deals’.
ALTER TABLE deals
ADD approved boolean;
Example 2: Deletes the ‘approved’ column from the ‘deals’ table
ALTER TABLE deals
DROP COLUMN approved;

sql alter table

user213

-- With check if field already exists

IF NOT EXISTS(SELECT 1 FROM sys.columns 
          WHERE Name = N'Email'
          AND Object_ID = Object_ID(N'dbo.Customers'))
BEGIN    
	ALTER TABLE Customers
    ADD Email varchar(255);
END