"Execute stored procedure with Read Database operator"

EMDuell
EMDuell New Altair Community Member
edited November 2024 in Community Q&A
Hello,

I'm attempting to execute a stored procedure with the Read Database operator and I receive an error, saying "executeQuery only accepts the SELECT statement".

Is there a special technique I need to use to pass parameters to a stored procedure so that I can read the results into an example set?  I thought about the the Execute SQL operator, but that won't work.

Thanks for the help..code below.

-Eric

---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="5.3.015">
 <context>
   <input/>
   <output/>
   <macros/>
 </context>
 <operator activated="true" class="process" compatibility="5.3.015" expanded="true" name="Process">
   <process expanded="true">
     <operator activated="true" class="read_database" compatibility="5.3.015" expanded="true" height="60" name="Read Database" width="90" x="45" y="19">
       <parameter key="connection" value="TestQuery"/>
       <parameter key="query" value="EXEC GetRemainingRequests @Resource=Trends"/&gt;
       <enumeration key="parameters"/>
     </operator>
     <connect from_op="Read Database" from_port="output" to_port="result 1"/>
     <portSpacing port="source_input 1" spacing="0"/>
     <portSpacing port="sink_result 1" spacing="0"/>
     <portSpacing port="sink_result 2" spacing="0"/>
   </process>
 </operator>
</process>


Answers

  • BalazsBaranyRM
    BalazsBaranyRM New Altair Community Member
    Does your function return a table structure? If it does, try wrapping it in a SELECT query:

    SELECT *
    FROM (
       EXEC GetRemainingRequests @Resource=Trends
    )

    There is also an Execute SQL operator for calling arbitrary functions but it doesn't return an example set.

Welcome!

It looks like you're new here. Sign in or register to get started.

Welcome!

It looks like you're new here. Sign in or register to get started.