IF EXISTS (select * from dbo.sysobjects where id = object_id(N'{objectQualifier}DMX_GetEntryAttributeList') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE {databaseOwner}{objectQualifier}DMX_GetEntryAttributeList
GO

CREATE PROCEDURE {databaseOwner}{objectQualifier}DMX_GetEntryAttributeList
  @PortalId Int, @EntryId Int
AS

SELECT {databaseOwner}{objectQualifier}DMX_Attributes.*, AttributeValues.Value

FROM {databaseOwner}{objectQualifier}DMX_Attributes LEFT JOIN (
SELECT * FROM {databaseOwner}{objectQualifier}DMX_EntryAttributes WHERE {databaseOwner}{objectQualifier}DMX_EntryAttributes.EntryId=@EntryId)
AS AttributeValues
ON {databaseOwner}{objectQualifier}DMX_Attributes.id=AttributeValues.Attribute
WHERE (({objectQualifier}DMX_Attributes.PortalId)=@PortalId)

GO

