Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

MS SQL Query to show data in database

Kevin Seery
Contributor
December 28, 2017

Hi,

 

I have a custom field that imports data from another database. I need to find out what the data looks like in JIRA. Are 0 stored as Null or 0?

I have tried with out success to get the information out of JIRA which is on a MySQL DB.

Can someone share the query to achieve this?

Many Thanks

Kevin

 

3 answers

1 vote
Ignacio Pulgar
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 28, 2017

Every issue has an entry in the JIRAISSUE table with its own numeric id.

Likewise, every custom field is represented as a row in the CUSTOMFIELD table with its id.

There's an intermediate table between both of those tables named CUSTOMFIELDVALUE, each of which rows contains one issue id, one custom field id, and the stored value:

Screenshot_20171228-213833.png

Ignacio Pulgar
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 28, 2017

That said, NULL values simply do not have a row in the CUSTOMFIELDVALUE table.

1 vote
somethingblue
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 28, 2017

Hi Kevin,

I believe the answer to your question is going to be NULL.  Depending on what information you're looking for, here is the database schema for JIRA.

You can use it to create queries and determine how the database is layed out.  In addition, at the top of that article is a jar file depending on whether you're using JIRA 5,6 or 7 to generate schema information for the JIRA database.  Here is the one for JIRA 7: jira-schema-diagram-generator-plugin-1.1.0.jar.

Cheers,

Branden

Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 28, 2017

@somethingblue

I believe that null values for custom fields are not stored in the database otherwise the database would be much larger in size.

1 vote
Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 28, 2017

Hello,

Null's are not stored at all.

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 28, 2017

Yup.  If a custom field does not have a value, there is no row in customfieldvalue at all. 

It would be a very good idea to forget about using the database - the API will give you better answers, more easily.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events