Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ALTER TABLE to add column with nulls

Status
Not open for further replies.

jararaca

Programmer
Jun 1, 2005
159
US
How do I use ALTER TABLE to add a column that allows nulls?

Thank you!
 
ALTER TABLE TableName ADD ColumnName DataType NULL


example
Code:
CREATE TABLE CategoryList ( 
        Category varchar(50) NOT NULL
       
) 

--here it is
ALTER TABLE CategoryList ADD Column2 int NULL

INSERT INTO CategoryList VALUES ('Test Category',NULL) 

INSERT INTO CategoryList VALUES ('Test Category',123) 


select * from CategoryList

Denis The SQL Menace
SQL blog:
Personal Blog:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top