Skip to main content
Question

dbQuery with multiple statements

  • December 3, 2025
  • 1 reply
  • 44 views

Forum|alt.badge.img

How can I get this Sql Server dbQuery to work? The INSERT is completing fine, but I need to get the inserted identity PK and Arc is not picking it up.

<arc:set attr="db.query">
insert into table (...) values (...);
select SCOPE_IDENTITY();
</arc:set>


<arc:call op="dbQuery" in="db" out="results">
...

Is there a better way to get the identity? 

(I have to use ArcScript, the upsert connector is not an option)

This topic has been closed for replies.

1 reply

lohith
  • Employee
  • December 24, 2025

Hi Tavis,

The updated script would look like below:

<arc:set attr="db.query">
insert into table (...)
OUTPUT INSERTED.<columnName>
values (...);
</arc:set>
<arc:call op="dbQuery" in="db" out="results">
...

Here the column name refers to the PK column or any column you would like return on successful insert.

Let me know if this works for you?