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

CREATE PROCEDURE {databaseOwner}{objectQualifier}DMX_GetCompletePortalEntryList
  @PortalId Int
AS

SELECT {databaseOwner}{objectQualifier}DMX_Entries.*, Entries_1.Description AS CollectionName, {databaseOwner}{objectQualifier}DMX_Extensions.Icon16
FROM ({objectQualifier}DMX_Entries LEFT JOIN {databaseOwner}{objectQualifier}DMX_Entries AS Entries_1 ON {databaseOwner}{objectQualifier}DMX_Entries.CollectionId = Entries_1.EntryId) INNER JOIN {databaseOwner}{objectQualifier}DMX_Extensions ON ({objectQualifier}DMX_Entries.EntryType = {databaseOwner}{objectQualifier}DMX_Extensions.ExtensionKey) AND ({objectQualifier}DMX_Entries.PortalId = {databaseOwner}{objectQualifier}DMX_Extensions.PortalId)
WHERE ((({objectQualifier}DMX_Entries.PortalId)=@PortalId))

GO

