EnVisageOnline/Main-RMO/Database/Scripts/20150414/01_add_capacity_col.sql

19 lines
588 B
Transact-SQL

use Envisage
begin tran
if not exists (select * from sys.all_columns where name like 'ActualCapacityScenarioId' and object_id = OBJECT_ID('Team'))
begin
alter table [Team]
add [ActualCapacityScenarioId] uniqueidentifier NULL
end
if not exists (select * from sys.foreign_keys where name like 'FK_Team_Scenario1' and object_id = OBJECT_ID('Team'))
begin
ALTER TABLE [dbo].[Team] WITH CHECK ADD CONSTRAINT [FK_Team_Scenario1] FOREIGN KEY([ActualCapacityScenarioId])
REFERENCES [dbo].[Scenario] ([Id])
ALTER TABLE [dbo].[Team] CHECK CONSTRAINT [FK_Team_Scenario1]
end
commit tran