Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
badges earned

Your Points Tracker
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

How to write a SQL query to update custom field data to jira “description” field?


How to write a SQL query to update custom field data to jira “description” field?

The custom field name = Issue Description
Filed Type = Free Text Field unlimited text

How do I update from above mention custom field to jira “description” field for a "selected Project" by using with SQL query.?

Could you please provide the SQL script, so that I can use that query to update the data from custom field to description field.

Ganga S

3 answers

1 accepted

0 votes
Answer accepted

Hi Ganga,

The following works on MySQL but i'm not sure if other databases understand that as well

update jiraissue,customfieldvalue
set jiraissue.description = customfieldvalue.textvalue 
where customfield = 12345 and = customfieldvalue.issue and jiraissue.project = xxxxx;

12345 is the id of your unlimited text area custom field, xxxxx is the id of your project

Please always follow Nics hints for such operations

Hi Dieter,

Thanks for the SQL query. It is really useful.

I am using MS SQL 2008 R2, first I will try on our test environment and let you know the status.

Sure, I will follow the @Nic instructions before proceed and also I took the table backup using with

Select *into jiraschema.jiraissue_bak fromjiraschema.jiraissue

It means, for a test, I am going to run the update query on the backup table instead actual table

Ganga S

Hi Nic/Dieter.

Firstly: Thanks for the help....

It works. I used outer join query to update data from custom field to jira issue description field on a SQL 2008 R2 database. Outer join updates only matching records.

update jiraschema.jiraissue
set jiraschema.jiraissue.description = jiraschema.customfieldvalue.textvalue
from jiraschema.jiraissue left join jiraschema.customfieldvalue
on jiraschema.customfieldvalue.issue =
where jiraschema.customfieldvalue.customfield = 12345
and jiraschema.jiraissue.project = xxxxx;

Ganga S

1 vote

It's not a simple script. To get the data out, you need to read "jiraissue where project = xxxxx" (xxxxx being the project you're interested in - read table "project" to find that), then for each jiraissue record found, read "customfieldvalue.text where issue = and customfield = yyyyy" (where yyyyy = the custom field id for your free text field). Finally, to write the data, you update jiraissue.description with the value you've just read.

Please remember that when you do this, you absolutely MUST

  1. Take Jira offline
  2. Take a backup
  3. Restore it to prove it is a good backup
  4. Run the SQL
  5. Restart Jira
  6. Re-index it

Thanks Nic,

I am nerves with complex query, but I will try on my test machine….

Ganga S

Always a good idea to test first :-)

The SQL Dieter gives looks correct to me, with a couple of minor points:

  1. I think it will overwrite all the descriptions on all the issues with the value of the custom field, which may not be what you want.
  2. Also, I'm not sure how MS-SQL will react if the customfield is empty. When a field is empty, Jira doesn't have any record at all for the value of the field, so "customfieldvalue.textvalue" won't come back with anything.

Thanks for the second consideration....

#1. I wanted to overwrite all the issues description for a particular "Project". It means not for other project issues description.

#2. It is an interesting point.... I will try on test machine first..... and update the status.

Ganga S

Hi @Nic Brough _Adaptavist_ Could you please help me How to write a SQL query to update custom field data to jira “due date” field?

due date is not a custom field.

I would very strongly recommend not using SQL to change data in Jira.  To do it, you need Jira backed up, shut down and fully re-indexed after restart, so it's slow, clunky and inefficient.

What are you really trying to achieve?

Suggest an answer

Log in or Sign up to answer

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