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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.