# No id returned on Insert

**URL:** <https://community.dreamfactory.com/t/no-id-returned-on-insert/3428>\
**Category:** REST API\
**Created:** [November 7, 2016, 8:27pm UTC](https://community.dreamfactory.com/t/no-id-returned-on-insert/3428 "2016-11-07T20:27:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![James\_Sterling](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/james_sterling/32/885_2.png) [@James\_Sterling](https://community.dreamfactory.com/u/James_Sterling)\
**Post date:** [November 7, 2016, 8:27pm UTC](https://community.dreamfactory.com/t/no-id-returned-on-insert/3428/1 "2016-11-07T20:27:05Z")

</div>

Using the MSSQL driver, when inserting only the following is returned,

```json
{"resource":[[]]}

```

Looks like the code here is not meeting the conditions to use the `$builder->insertGetId(...)` Laravel method in the `vendor/dreamfactory/df-sqldb/src/Resources/Table.php` file.

```php
if (empty($id) && (1 === count($this->tableIdsInfo)) && $this->tableIdsInfo[0]->autoIncrement) {
    $idName = $this->tableIdsInfo[0]->name;
    $id[$idName] = $builder->insertGetId($parsed, $idName);
    $record[$idName] = $id[$idName];
} else {
    if (!$builder->insert($parsed)) {
        throw new InternalServerErrorException("Record insert failed.");
    }
}

```

Using dreamfactory version 2.1.2.

---

<div class="post-metadata">

**Author:** ![formerstaff](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/formerstaff/32/1133_2.png) [@formerstaff](https://community.dreamfactory.com/u/formerstaff)\
**Post date:** [November 16, 2016, 4:55pm UTC](https://community.dreamfactory.com/t/no-id-returned-on-insert/3428/2 "2016-11-16T16:55:48Z")

</div>

There is a known issue that generates this response IF the id of the record is generated using a function (such a `NEWID()`.)  
If this is issue is present just generally (i.e. you manually create the record ID, or it’s an autoincrement INT) then this is fixed in later releases.

---

<div class="post-metadata">

**Author:** ![James\_Sterling](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/james_sterling/32/885_2.png) [@James\_Sterling](https://community.dreamfactory.com/u/James_Sterling)\
**Post date:** [November 16, 2016, 5:07pm UTC](https://community.dreamfactory.com/t/no-id-returned-on-insert/3428/3 "2016-11-16T17:07:00Z")

</div>

Thanks for the info @formerstaff. Do you know which release this is fixed in?
