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.
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 jiraissue.id = 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
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
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.
set jiraschema.jiraissue.description = jiraschema.customfieldvalue.textvalue
from jiraschema.jiraissue left join jiraschema.customfieldvalue
on jiraschema.customfieldvalue.issue = jiraschema.jiraissue.id
where jiraschema.customfieldvalue.customfield = 12345
and jiraschema.jiraissue.project = xxxxx;
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 = jiraissue.id 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
Always a good idea to test first :-)
The SQL Dieter gives looks correct to me, with a couple of minor points:
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.
Hi all! Lauren here from the Enterprise Cloud marketing team. I have some exciting Cloud updates from #AtlassianSummit that I wanted to share. We want everyone in your organization to be ab...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs