> For the complete documentation index, see [llms.txt](https://help.besmart.software/erpc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.besmart.software/erpc/cz-erp-connector/datove-rozhrani-referencni-manual/import-dat-do-vaultu/zapis-dat-do-datoveho-rozhrani/pouziti-syntaxe-sql.md).

# Použití syntaxe SQL

pro získání jedinečného bulk\_id se doporučuje použít syntaxi "OUTPUT INSERTED":

```sql
DECLARE @result TABLE ( bid bigint, rid bigint );
INSERT INTO EcENTITY (comm_dir, bulk_id, ent_class_id, name) OUTPUT INSERTED. bulk_id, INSERTED. ID INTO @result
VALUES ( 1, ISNULL((SELECT MAX(bulk_id) FROM EcENTITY), 0) + 1, N'ITEM', N'ARTKL-10001');
SELECT * FROM @result;
```
