This project is read-only.
1

Closed

Index creation failed for table Files

description

Hi Sebastian,

First of all, thank you for scripts.
I got one error when running script "DNN Turbo Base Version 0.9.9 (2016-08-26)"
Error was related to the fact that my table Files had some duplications for some reason.
After removing duplications from table Files script ran normaly without error.

It is probably worth to check for files duplications before creating index on the table Files.

IF EXISTS (
SELECT *
FROM (SELECT PortalId, Folder, FileName, COUNT(*) As DuplicatesCount
       FROM dbo.Files
       GROUP BY PortalId,  Folder,  FileName
       ) T
       WHERE T.DuplicatesCount > 1 )
BEGIN
PRINT 'Duplicated files on table Files detected'
END

Thank you very much for your time!

Kind Regards,
Jonas
Closed Sep 23, 2016 at 5:49 PM by leupold
Fixed in latest version

comments

leupold wrote Sep 17, 2016 at 10:45 AM

Jonas,
thanks for the feedback. I will add a statement to remove duplicate items before adding the index:
DELETE FROM {dabaseOwner}[{objectQualifier}Files]
WHERE FileID NOT IN (SELECT Max(FileID) FROM {dabaseOwner}[{objectQualifier}Files] GROUP BY FolderID, FileName) 
Best,
Sebastian