Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

SQL Query for Sprint Issues Added and Removed

Hello,

Is there a SQL way to retrieve Issues added or removed from a sprint? I am not looking for JQL options.

2 answers

0 votes

No, the data is not recorded in the database.  Unless it's a scope change in an active sprint.

Yes, I am referring to once the sprint starts, issues added and removed from an active sprint. Is there a way to query it?

Best I can tell, you need to look in two places:

  1. Issues created after the Start of the Sprint that are tied to your sprint.  
  2. Issues that reflect a Sprint Change in the Change Log

 

For #1 (Issues Created After the Start of the Sprint)

SELECT 
b.NAME SprintBoardName,
b.ID SprintBoardID,
S.NAME SprintName,
s.ID sprintID,
convert(date,DATEADD(SECOND, s.start_date / 1000, '19700101 00:00')) SprintStart,
p.pkey+'-'+cast(i.issuenum as NCHAR(10)) IssueKey,
i.id IssueId,
convert(date, i.created) IssueCreated,
convert(date,i.RESOLUTIONDATE) IssueResolutionDate
FROM customfieldvalue c,
jiraissue i,
project p,
AO_60DB71_SPRINT s
left join AO_60DB71_RAPIDVIEW b on b.ID=s.RAPID_VIEW_ID
where i.project=p.id
and i.ID=c.ISSUE
and c.CUSTOMFIELD = 10000
and s.ID=CAST(c.STRINGVALUE as int)
and (i.RESOLUTIONDATE is null or i.resolutiondate >= DATEADD(m, -6, current_timestamp))
and (s.start_date is null or convert(date,DATEADD(SECOND, s.start_date / 1000, '19700101 00:00')) >= DATEADD(m, -6, current_timestamp))
and convert(date,DATEADD(SECOND, s.start_date / 1000, '19700101 00:00')) < convert(date,i.created)

 

For #2 - Issues that have Sprint values Changed.  (this example pulls all Sprint Changes for the last 6 months)


SELECT
p.pkey+'-'+cast(i.issuenum as NCHAR(10)) IssueKey,
i.id IssueId,
convert(date,cg.created) as ChangeDate,
case when ci.oldstring is null then ' ' else ci.oldstring End SprintOld,
case when ci.newstring is null then ' ' else ci.newstring End SprintNew
FROM jiraissue i,
project p,
changeitem ci,
changegroup cg
where
(i.RESOLUTIONDATE is null or i.resolutiondate >= DATEADD(m, -6, current_timestamp))
and i.project=p.id
and cg.issueid = i.id
and ci.groupid = cg.id
and ci.field = 'Sprint'

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you