The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Would like query for SQL Server to locate attachments. Was provided the below. Will either of these work for SQL Server?
selectc.TITLE as "Attachment Name", cp.LONGVAL as "File Size",c2.TITLE as "Page Title", s.SPACENAME as "Space Name", concat("http://<confluence_base_url>/pages/viewpageattachments.action?pageId=", c.PAGEID) as "Location"from CONTENT cjoin CONTENT c2 on c.PAGEID = c2.CONTENTIDjoin CONTENTPROPERTIES cp on c.CONTENTID = cp.CONTENTIDjoin SPACES s on c2.SPACEID = s.SPACEID where c.CONTENTTYPE = 'ATTACHMENT' and cp.PROPERTYNAME = 'FILESIZE'order by cp.LONGVAL desc;
select c.TITLE as Attachment_Name, cp.LONGVAL as Attachment_Size, s.spacename,c2.TITLE as Page_Title,'http://<confluence_base_url>/pages/viewpageattachments.action?pageId='||c.PAGEID as Locationfrom CONTENT cjoin CONTENT c2 ON c.PAGEID = c2.CONTENTIDjoin CONTENTPROPERTIES cp on c.CONTENTID = cp.CONTENTIDjoin SPACES s on c2.SPACEID = s.SPACEIDwhere c.CONTENTTYPE = 'ATTACHMENT' and cp.PROPERTYNAME = 'FILESIZE'order by cp.LONGVAL desc;
Replace <confluence_base_url> with your Confluence Base URL . This was tested against MySQL and PostgreSQL.
Hi @Amy Carey
I believe the query for MySQL should work fine on MS SQL Server.
The only function there is CONCAT which has the same syntax on SQL Server.
Let us know if you get any error when running it.
Kind regards,
Thiago Masutti
Thank you Thiago. We'd like to also add the path and last modified date. How may the query be updated to include that information?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi everyone, We’re always looking at how to improve Confluence and customer feedback plays an important role in making sure we're investing in the areas that will bring the most value to the most c...
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.