Skip to content

Instantly share code, notes, and snippets.

@timgaunt
Last active May 9, 2021 19:39
Show Gist options
  • Save timgaunt/298e5a0b15deb23b81c5513c42b6c19e to your computer and use it in GitHub Desktop.
Save timgaunt/298e5a0b15deb23b81c5513c42b6c19e to your computer and use it in GitHub Desktop.
Find Umbraco Media Files by Size
SELECT n.id, n.text, n.createDate, c.contentTypeId, FORMAT(CAST(pd.varcharValue AS DECIMAL(18,2)) / 1024 / 1024, '0.00') AS [FileSizeMB], CONCAT('https://wc.uat.sitedr.co.uk/umbraco#/media/media/edit/', n.id)
FROM umbracoNode n left JOIN umbracoContent c ON n.id = c.nodeId LEFT JOIN umbracoContentVersion cv ON c.nodeId = cv.nodeId LEFT JOIN umbracoPropertyData pd ON cv.id = pd.versionId AND pd.propertyTypeId=9
where c.contentTypeId=1032 AND cv.[current]=1
ORDER BY CAST(pd.varcharValue AS BIGINT) DESC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment