ALTER TABLE [SdkElement] ADD 
    CONSTRAINT [SdkElement_PK] PRIMARY KEY 
		([DeviceGuid], [SdkElementTypeID], [SdkElementGuid])
go


ALTER TABLE [SdkElementAttributeType] ADD 
    CONSTRAINT [SdkElementAttributeType_PK] PRIMARY KEY  
		([SdkElementAttributeTypeID])
go

ALTER TABLE [SdkElementType] ADD 
    CONSTRAINT [SdkElementType_PK] PRIMARY KEY
		([SdkElementTypeID])
go



CREATE UNIQUE INDEX [AK_SdkElement_SdkElementGuid] ON [SdkElement]([SdkElementGuid])
go



/*
	for 7.1.2 2012-R2-FP2
alter table SdkElementAttributeData
	add [TextValue] ntext NOT null

*/
drop table [SdkElementAttributeData]
go

CREATE TABLE [SdkElementAttributeData](
    [SdkElementGuid]             uniqueidentifier    NOT NULL,
    [SdkElementAttributeTypeID]  int                 NOT NULL,
	[DateModified]               datetime            NOT NULL
	,[TextValue] ntext NOT null
)
go
ALTER TABLE [SdkElementAttributeData] ADD 
    CONSTRAINT [SdkElementAttributeData_PK] PRIMARY KEY  
		([SdkElementGuid], [SdkElementAttributeTypeID])
go