EnVisageOnline/Main-RMO/Database/Scripts/20140730/01_PK_ScenarioCln_PK.sql

25 lines
687 B
Transact-SQL

USE [envisage]
update ScenarioCln set SystemAttributeObjectID = '00000000-0000-0000-0000-000000000000'
where SystemAttributeObjectID is null
GO
alter table ScenarioCln alter column SystemAttributeObjectID uniqueidentifier not null
GO
if exists (select * from sys.all_objects where name like 'PK_ScenarioCln' and parent_object_id = OBJECT_ID('ScenarioCln') and type = 'PK')
begin
ALTER TABLE dbo.ScenarioCln DROP CONSTRAINT PK_ScenarioCln
end
ALTER TABLE dbo.ScenarioCln ADD CONSTRAINT
PK_ScenarioCln PRIMARY KEY CLUSTERED
(
Id, SystemAttributeObjectID
) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO