ALTER TABLE <table name> ADD <new column name> <data type> NOT NULL GO
Add foreign KeyALTER TABLE <table name> ADD CONSTRAINT <constraint name> DEFAULT <default value> FOR <new column name> GO
ALTER TABLE <Table_Name> ADD FOREIGN KEY(<ColumnName>) REFERENCES <Primary_Table_Name>(<Primary_column_Name>)
ALTER TABLE dbo.AssetInventory ADD FOREIGN KEY(RegionID) REFERENCES Region(RegionID)
Example:
ALTER TABLE dbo.AssetInventory ADD ASSET_PARENT int NULL
No comments:
Post a Comment