Skip to main content
Solved

Can I attach an external SQL file to the 'Execute source code' step during 'Creation'?

  • February 21, 2019
  • 3 replies
  • 241 views

Mark Jongeling
Administrator
Forum|alt.badge.img+23
To be precise, I have other application which generates a script. This script I would like the Software Factory to run during the 'Execute source code' step of another application. How can I make this work?

My idea is that the Software Factory reads from a certain file path, looking for the SQL file and then attaching it to the 'Execute source code' step, but if there's another/better way I would love to hear it.

(It is not an option to generate the code inside the application where I would like the script to be run on)

Best answer by Anne Buit

Hi Mark,

You can create a new control procedure in the code group MANUAL. You might have to remove a prefilter from the code groups in the look-up to be able to select it.

The template of this control procedure should contain the code you need to run. This template can be assigned to a program object, also called manual.

This will cause a new code file to appear in the source code execution screen, at the bottom, called (coincidentally) manual.

This method will not read a file from disk, and instead will require you to put the code to be executed in a template. Will this suffice?
View original
Did this topic help you find an answer to your question?

3 replies

Anne Buit
Community Manager
Forum|alt.badge.img+5
  • Community Manager
  • 653 replies
  • Answer
  • February 21, 2019
Hi Mark,

You can create a new control procedure in the code group MANUAL. You might have to remove a prefilter from the code groups in the look-up to be able to select it.

The template of this control procedure should contain the code you need to run. This template can be assigned to a program object, also called manual.

This will cause a new code file to appear in the source code execution screen, at the bottom, called (coincidentally) manual.

This method will not read a file from disk, and instead will require you to put the code to be executed in a template. Will this suffice?

Mark Jongeling
Administrator
Forum|alt.badge.img+23
  • Author
  • Administrator
  • 3945 replies
  • February 21, 2019
Anne Buit wrote:
Hi Mark,

You can create a new control procedure in the code group MANUAL. You might have to remove a prefilter from the code groups in the look-up to be able to select it.

The template of this control procedure should contain the code you need to run. This template can be assigned to a program object, also called manual.

This will cause a new code file to appear in the source code execution screen, at the bottom, called (coincidentally) manual.

This method will not read a file from disk, and instead will require you to put the code to be executed in a template. Will this suffice?


Hey Anne, thanks for your answer. This kind of answers it all but I really would want to read a file from a specific location for my purpose. So I used google and found a helpful result which helps me achieve my vision:

code:
declare @filecontents nvarchar(max)

select @filecontents = bulkcolumn
from openrowset(bulk 'path+filename.sql',single_clob) x; -- char

exec sp_executesql @filecontents


So in combination with a Manual control procedure and this piece of code I can make sure my SQL file gets executed on the right database. Thanks!

Arie V
Community Manager
Forum|alt.badge.img+12
  • Community Manager
  • 1030 replies
  • January 11, 2022

@Anne Buit As part of investigating the possibilities for automating the deployments, I was looking for possibilities to run code at the end of an Custom Application deployment. I finally found this topic with the ‘MANUAL’ Code Group option, but couldn’t find any reference to this in the Docs. 

This is potentially great stuff, could this Manual stored procedure option be added to the Docs?


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings