# Extracting NEWID from MS SQL Insert

**URL:** <https://connective.celigo.com/t/extracting-newid-from-ms-sql-insert/5249>\
**Category:** Integrator.io\
**Tags:** import, flow-builder\
**Created:** [August 11, 2025, 6:39pm UTC](https://connective.celigo.com/t/extracting-newid-from-ms-sql-insert/5249 "2025-08-11T18:39:58Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![troythompson](https://avatars.discourse-cdn.com/v4/letter/t/ecae2f/32.png) [@troythompson](https://connective.celigo.com/u/troythompson)\
**Post date:** [August 11, 2025, 6:39pm UTC](https://connective.celigo.com/t/extracting-newid-from-ms-sql-insert/5249/1 "2025-08-11T18:39:58Z")

</div>

I’m creating a flow which inserts records into a MS SQL table; one of the fields is a unique ID created via NEWID().

The insert result appears in the SQL connection debug log:

{" **response**":[{" **value**":"7B45B75E-2103-406D-8D9F-8000EF6CCA3C","metadata":{"userType":0,"flags":8,"type":{"id":36,"type":"GUIDN","name":"UniqueIdentifier"},"dataLength":16," **colName**":" **ExternalExpenseId**"}}]}

However, I cannot determine how to map the value returned in the Response Mapping screen.

I’ve tried MANY combinations of mock data, field mappings, JSON, you name it, but I can’t figure out if the SQL server response actually ends up in the Celigo flow anywhere.

Here is my current mock response in my Import step: Pretty sure I’m following the instructions where it says to replace the MockResponse key and data with my own:

```auto
[
  {
    "id": "1234567890",
    "errors": [],
    "_json": {
      "id": "1234567890",
      "response": [
        {
          "value": "7B45B75E-2103-406D-8D9F-8000EF6CCA3C",
          "metadata": {
            "userType": 0,
            "flags": 8,
            "type": {
              "id": 36,
              "type": "GUIDN",
              "name": "UniqueIdentifier"
            },
            "dataLength": 16,
            "colName": "ExternalExpenseId"
          }
        }
      ]
    },
    "statusCode": 200,
    "ignored": false,
    "dataURI": "",
    "_headers": {
      "content-type": "application/json; charset=utf-8"
    }
  }
]

```

I’ve tried \_json.response[0].value, response.value, response[0].value, and many other permutations of manually entered paths; for some of these I can see the result in the mapper. However, the value is empty at the next import step.

How can I extract the REAL response MS SQL server is returning?

---

<div class="post-metadata">

**Author:** ![troythompson](https://avatars.discourse-cdn.com/v4/letter/t/ecae2f/32.png) [@troythompson](https://connective.celigo.com/u/troythompson)\
**Post date:** [August 11, 2025, 6:47pm UTC](https://connective.celigo.com/t/extracting-newid-from-ms-sql-insert/5249/2 "2025-08-11T18:47:39Z")

</div>

Note: the native default Celigo “id” field isn’t populating during MS SQL inserts. Not sure why.

---

<div class="post-metadata">

**Author:** ![tylerlamparter](https://sea1.discourse-cdn.com/flex001/user_avatar/connective.celigo.com/tylerlamparter/32/9204_2.png) [@tylerlamparter](https://connective.celigo.com/u/tylerlamparter)\
**Post date:** [August 12, 2025, 3:13am UTC](https://connective.celigo.com/t/extracting-newid-from-ms-sql-insert/5249/3 "2025-08-12T03:13:47Z")

</div>

Can you try just `_json` and then see if you get anything there downstream?

---

<div class="post-metadata">

**Author:** ![troythompson](https://avatars.discourse-cdn.com/v4/letter/t/ecae2f/32.png) [@troythompson](https://connective.celigo.com/u/troythompson)\
**Post date:** [August 12, 2025, 3:30pm UTC](https://connective.celigo.com/t/extracting-newid-from-ms-sql-insert/5249/4 "2025-08-12T15:30:29Z")

</div>

I tested further, assigning the \_json to another header property. The JSON is just {} an empty brace set.

I am not using bulk insert here because of the need to extract the NEWID value. There are workarounds via SQL which essentially tell the SQL server to store the NEWID value in a secondary table, so I could in theory do the insert then turn right around and lookup the new ID in another flow step. Icky!

Bottom line seems to be that SQL imports via “Use SQL query once per record” do not return an ID (which I expect), nor do they return anything indicated by the connection debugger. Feels like it’s time to log a case.

---

<div class="post-metadata">

**Author:** ![tylerlamparter](https://sea1.discourse-cdn.com/flex001/user_avatar/connective.celigo.com/tylerlamparter/32/9204_2.png) [@tylerlamparter](https://connective.celigo.com/u/tylerlamparter)\
**Post date:** [August 12, 2025, 11:14pm UTC](https://connective.celigo.com/t/extracting-newid-from-ms-sql-insert/5249/5 "2025-08-12T23:14:26Z")

</div>

I checked internally and this is currently a limitation. Can you make a subsequent lookup step to fetch it?

---

<div class="post-metadata">

**Author:** ![troythompson](https://avatars.discourse-cdn.com/v4/letter/t/ecae2f/32.png) [@troythompson](https://connective.celigo.com/u/troythompson)\
**Post date:** [August 13, 2025, 9:02pm UTC](https://connective.celigo.com/t/extracting-newid-from-ms-sql-insert/5249/6 "2025-08-13T21:02:33Z")

</div>

In this particular situation, I have another unique ID in the data rows (a NetSuite internal ID) that I can use to perform the extra lookup step. A workaround is in place.

I opened a case with support too; maybe it’ll become a feature request?

I’ll post what happens!

---

<div class="post-metadata">

**Author:** ![tylerlamparter](https://sea1.discourse-cdn.com/flex001/user_avatar/connective.celigo.com/tylerlamparter/32/9204_2.png) [@tylerlamparter](https://connective.celigo.com/u/tylerlamparter)\
**Post date:** [August 13, 2025, 9:32pm UTC](https://connective.celigo.com/t/extracting-newid-from-ms-sql-insert/5249/7 "2025-08-13T21:32:53Z")

</div>

Sounds good! I’m still checking internally if this is a bug or enhancement. Since we can see the response in debug logs, it seems like a bug 🙂

---

<div class="post-metadata">

**Author:** ![troythompson](https://avatars.discourse-cdn.com/v4/letter/t/ecae2f/32.png) [@troythompson](https://connective.celigo.com/u/troythompson)\
**Post date:** [August 14, 2025, 5:49pm UTC](https://connective.celigo.com/t/extracting-newid-from-ms-sql-insert/5249/8 "2025-08-14T17:49:22Z")

</div>

As of now (14 Aug 2025) support ticket indicates that the dev team is reviewing this as a _potential_ bug; so it’s not been kicked back as a “behavior as designed” at least! I’m optimistic.

---

<div class="post-metadata">

**Author:** ![tylerlamparter](https://sea1.discourse-cdn.com/flex001/user_avatar/connective.celigo.com/tylerlamparter/32/9204_2.png) [@tylerlamparter](https://connective.celigo.com/u/tylerlamparter)\
**Post date:** [August 24, 2025, 7:58pm UTC](https://connective.celigo.com/t/extracting-newid-from-ms-sql-insert/5249/9 "2025-08-24T19:58:43Z")

</div>

Can you share what SQL query you’re running, the DDL of the table, and what SQL server version you’re using? We’ve tried a few scenarios and don’t get the response you’re seeing.

---

<div class="post-metadata">

**Author:** ![troythompson](https://avatars.discourse-cdn.com/v4/letter/t/ecae2f/32.png) [@troythompson](https://connective.celigo.com/u/troythompson)\
**Post date:** [August 25, 2025, 5:07pm UTC](https://connective.celigo.com/t/extracting-newid-from-ms-sql-insert/5249/10 "2025-08-25T17:07:13Z")

</div>

Update: this has been **confirmed as a bug** and is being forwarded up to the development team for review.

> As per testing by our product team, it was confirmed that this is indeed a bug.
> 
> This will be endorsed to the respective Dev Team for the fix.

Here is the MS SQL query patten I’m executing:

```auto
INSERT INTO [dbo].[ExternalExpenseLines] ( 
ExternalExpenseLineId, 
[ExternalExpenseId], 
… etc..
)
OUTPUT inserted.ExternalExpenseId 
VALUES ( 
NEWID(), 
{{record._PARENT.ExpenseObjectHeader.ExternalExpenseId}},
 … etc … 
);

```

SQL connector debug indicates the OUTPUT statement generates a response per inserted record:

`{"response":[{"value":"A16C6115-9501-4DCF-B9B6-323003385A85","metadata":{"userType":0,"flags":8,"type":{"id":36,"type":"GUIDN","name":"UniqueIdentifier"},"dataLength":16,"colName":"ExternalExpenseId"}}]}`

This JSON content of the response isn’t returned to the flow. In the response mapper panel it shows my example data. In real use, the statusCode is returned, but the remaining JSON is empty.
