I'm fairly new to SQL, and have just written SQL to query one of our databases which pulls out stats from our Service Desk.
We have the SQL addon so I could type {SQL} and then manually put my code in there, but as this will have to be done every week, and by 6 members of staff I'm looking to automate it slightly.
What I'm looking for is to type {my_stats} as a macro, and it will use a pre-defined SQL query already written. I've looked at different ways to do this and cannot find the best way to do it. I had created a user macro but it is just pasting the output as plain text when selecting the use macro.
Can someone point me in the right direction please?
This is my script:
SELECT
[category]
,COUNT(1) as TOTAL
FROM [METestDB].[MI].[TicketSURL]
where 1=1
and Technician = 'My Name'
and STATUSNAME = 'Closed'
and queuename not in ('Alerts')
and Completed_Time BETWEEN GETDATE()-7 AND GETDATE()
GROUP BY
[category]
So if a user selected the macro, it will use a pre-populated SQL query. Hope this makes sense.
Just to add to this, I cannot set the Output Format as 4.x version doesn't have the drop-down to change between html and wiki.