spGetIncompatibleContentPairs
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@PageId | int | IN |
Definition
Copy
CREATE PROCEDURE dbo.spGetIncompatibleContentPairs(@PageId int)
AS
--This procedure takes a page id and returns pairs of
--content type ids that are incompatible to appear on the same page together
--according to the tuples stored in the IncompatibleContentTypes table
DECLARE @IDS Table(Id int)
INSERT INTO @IDS(Id) SELECT ContentTypesID FROM dbo.fnPageAndTemplatePartsList(@PageId)
SELECT ICT.ContentTypeID, CT.Name ContentTypeName, ICT.IncompatibleContentID, CT2.Name IncompatContentTypeName
FROM dbo.IncompatibleContentTypes ICT
INNER JOIN dbo.contenttypes CT
ON ICT.contenttypeid = CT.id
INNER JOIN dbo.contenttypes CT2
ON CT2.id=ICT.incompatiblecontentid
INNER JOIN (
SELECT DISTINCT id FROM @IDS
) CTID
ON
ICT.ContentTypeID=CTID.ID
WHERE
ICT.IncompatibleContentID IN (
SELECT Id FROM @IDS
)
AND
--Different pieces of content are incompatible
(ICT.IncompatibleContentID <> ICT.ContentTypeID)
OR
--two of the same incompatible part on the page
(
ICT.IncompatibleContentID = ICT.ContentTypeID
AND CTID.ID IN (
SELECT Id FROM @IDS GROUP BY Id HAVING COUNT(Id) > 1
)
)