Friday, March 25, 2022

Add a column with a default value to an existing table in SQL Server 2005

Format :

ALTER TABLE {Table_Name}

ADD {Column_Name} {NOT NULL|NULL}

CONSTRAINT {Constraint_Name} DEFAULT {Default_Value}

WITH Values

Contoh : 

 ALTER TABLE transaksi_master

ADD [ppn_persen] [numeric](18, 2) NULL

CONSTRAINT [DF_transaksi_master_ppn_persen] DEFAULT ((10))

WITH Values

No comments:

Post a Comment