Project and Portfolio Management Practitioners Forum
cancel

Run SQL query and store result in field within execution step

SOLVED
Go to solution
Highlighted
b460
Super Contributor.

Run SQL query and store result in field within execution step

Hi,

Does anyone know how I would be able to execute a SQL query and store the result in a field within an execution step?

I am trying to workout the amount of days a request is open for by subtracting the date closed with the creation date.

In my execution step I have the following commands:

ksc_run_sql QUERY_STRING="SELECT to_date(''[SYS.ITG_TIME_STAMP]'',''YYYY-MM-DD HH24:MI:SS'') - to_date(''[REQ.CREATION_DATE]'',''YYYY-MM-DD HH24:MI:SS'') FROM dual"

ksc_store DAYS_ISSUE_OPENED=[SQL_OUTPUT], [SQL_OUTPUT]

However it does not seem to work. Can anyone see why or how I would go about doing this?

Thanks.
2 REPLIES
Kalin Petrov
Respected Contributor.
Solution

Re: Run SQL query and store result in field within execution step

Hi,

1. Check if your database settings are defined correctly at the Environments section at the Workbench. Run "Check" to verify.

2. Try using "ksc_itg_run_sql" instead of "ksc_run_sql"

Regards,
Kalin
b460
Super Contributor.

Re: Run SQL query and store result in field within execution step

Thanks Kalin, ksc_itg_run_sql worked.