EnVisageOnline/Main/Database/Scripts/20140623/08_Scenario_UpdateColumns.sql

28 lines
798 B
Transact-SQL

use envisage
go
begin tran
if exists (select * from sys.all_columns where name like 'CreatorObjectId' and object_id like OBJECT_ID('[Scenario]'))
begin
ALTER TABLE [Scenario] DROP COLUMN CreatorObjectId
end
if not exists (select * from sys.all_columns where name like 'CreatorId' and object_id like OBJECT_ID('[Scenario]'))
begin
ALTER TABLE [Scenario] ADD [CreatorId] uniqueidentifier null
end
GO
if exists (select * from sys.all_columns where name like 'ModifiedByObjectId' and object_id like OBJECT_ID('[Scenario]'))
begin
ALTER TABLE [Scenario] DROP COLUMN ModifiedByObjectId
end
if not exists (select * from sys.all_columns where name like 'ModifiedById' and object_id like OBJECT_ID('[Scenario]'))
begin
ALTER TABLE [Scenario] ADD [ModifiedById] uniqueidentifier null
end
GO
commit tran