Solved

How to automate a Sql Server Connector

  • 5 May 2023
  • 2 replies
  • 75 views

Userlevel 1
Badge

I have a stored procedure that I want called once per day and the data pulled sent to a Send Email Connector. When I manually click the Receive button on the Output table of the Sql Server Connector, everything works as desired.  However, I set up the Receive Interval on the Automation Settings to Receive the data once per day, but it doesn’t run.  Am I doing something wrong? Or is there another way to automate the execution of this stored procedure?

 

 

Thanks,

Chris

icon

Best answer by James B 5 May 2023, 22:13

View original

2 replies

Userlevel 6
Badge

Does this stored procedure take any input parameters? The stored procedure action is one that might accept input parameters to drive the operation, and if that’s the case, it would be expected that the action would be driven based off of an input message. 

 

If that’s the case, there are a few ways that you can trigger the stored procedure:

  1. You can use a previous step, on the same Receive interval to generate the trigger file that calls to stored procedure
  2. You could also call a stored procedure from a Select action if you override the selectQuery in the mapping. Just select a random table, switch over to the design view, and use the following code to override the mapping:
    <Items>
    <MySP selectQuery="EXEC [dbo].[PortState]" allColumns="true" >
    </MySP>
    </Items>

    You can also explicitly call a stored procedure with parameters this way: 


    <Items>
    <MySP selectQuery="EXEC [dbo].[SelectName] 2" allColumns="true" >
    </MySP>
    </Items>

 

 

With all of that said, it sounds to me like the stored procedure you’re using doesn’t require input parameters (I’m not sure how it would work from the Receive action otherwise), and I would expect that to execute whenever the time matches the specified pattern. 

 

Is that the case here? If so, can you let us know what build of CData Arc you are using? And if it makes a difference if you use the Advanced option to use a cron expression:

 

 

Userlevel 1
Badge

James,

Thanks for the response.  It turns out it works fine.  I think the day I wrote this there weren’t any results returned and so that didn’t trigger the email or something.  But today and yesterday it worked as expected.  Sorry for the false alarm.

 

Chris

Reply