Create Missing PropertyData Entries
/* Create Missing PropertyData Entries */
Declare @ContentTypeAlias nvarchar(255), @PropertyTypeAlias nvarchar(255)
Set @ContentTypeAlias = 'nodeTypeAlias'
Set @PropertyTypeAlias = 'propertyAlias'
Declare @ContentTypeId int, @PropertyTypeId int
Set @ContentTypeId = ( Select top 1 nodeId
From cmsContentType
Where Alias = @ContentTypeAlias )
Set @PropertyTypeId = ( Select top 1 id
From cmsPropertyType
Where Alias = @PropertyTypeAlias AND contentTypeId = @ContentTypeId )
/* Uncomment the following line when ready to insert the records. */
--Insert Into cmsPropertyData (versionId, contentNodeId, propertytypeid)
Select cmsContentVersion.VersionId, cmsContentVersion.ContentId , @PropertyTypeId
From cmsContentVersion Inner Join
cmsContent on cmsContentVersion.ContentId = cmsContent.nodeId
Where cmsContent.contentType = @ContentTypeId and
Not Exists (Select versionId, contentNodeId, propertytypeid From cmsPropertyData)