Setting variable from a database query

We have a deployment where we need to do the following

  1. Run SQL to insert some new reference data into the DB
  2. Get the identifiers for the newly created records
  3. Put the new identifier values into Octopus variables

Is the nice way to do this fully automated? Currently our SQL is run via DBUp.

Hi Andrew,

Thanks for getting in touch! My first thought is perhaps output variables would work for you here, so you can run your SQL query and store what’s returned as an output variable in your step. This should allow you to retrieve the data, store it in the variable and then call the variable all within your deployment process. Would that be a valid approach to addressing your requirement?

Another possibly relevant/similar idea would be to have an API script to add a project variable which you could add as a script in your process. The following script might be a good starting point.

I hope that helps! Let me know what you think, or if I’m misinterpreting anything about what you’re after. :slight_smile:

Best regards,

Kenny

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.