|
---- Create Table
CREATE TABLE dbo.myTable
(
ID int NOT NULL,
Name char(23) NULL,
City char(30) NULL
)
GO
---- Alter Table (How to add New Columns; Drop and Alter existing Columns) ALTER TABLE dbo.myTable
---- Add a new column to the table ADD DOB datetime NULL,
---- Drop Existing Column DROP COLUMN City,
---- Alter Existing Column ALTER COLUMN Name char(30),
---- Add a new PRIMARY KEY CONSTRAINT to the table ADD CONSTRAINT PK_myTable PRIMARY KEY (ID)
|