#1 Re: mORMot 2 » MSSQL table with an IDENTITY field issue » 2026-08-20 14:54:00

Thank both for your help.

Yes, that's a good workaround if you are able to change the table structure.

Also found that setting the EngineAddForcedID property on the TRestStorageExternal instance, does the trick. That way, resulting insert statement doesn't include the ID field.
see example : https://gist.github.com/MRIAG2026/fe2aa … 14fa0dfa68

#2 Re: mORMot 2 » MSSQL table with an IDENTITY field issue » 2026-08-19 15:25:48

Thanks ab
Sorry for this, here is the link:
https://gist.github.com/MRIAG2026/dd69f … e0b2165465

in this case, I guess that if the MSSQL table with IDENTITY field is not supported by the ORM,  I will always have to call Execute/ExecuteInlined directly from TSQLDBConnectionProperties for inserting records.
Is this feature planned to be added in the future?

#3 mORMot 2 » MSSQL table with an IDENTITY field issue » 2026-08-19 09:47:05

augusto
Replies: 6

Hi All,

Please help.

I'm having trouble to get mORmot(2.4) ORM insert working with an existing MSSQL table with an IDENTITY field.

when I run

NewID := Server.Add(Rec, true);

It runs

"select max(ID) from dbo.RemoteProcessTest"

...and insists on sending the ID column in the insert statement - "insert into dbo.RemoteProcessTest (ID,ProcessId,Title) values (?,?,?))"
- then get an error :

Cannot insert explicit value for identity column in table 'RemoteProcessTest' when IDENTITY_INSERT is set to OFF

I'm not sure if this is a bug or if I'm missing something in my configuration.


Table:

CREATE TABLE dbo.RemoteProcessTest
(
    ID int IDENTITY(10000,1) NOT NULL,
    ProcessId varchar(40) NOT NULL,
    Title varchar(40) NOT NULL,

    CONSTRAINT PK_RemoteProcessTest
    PRIMARY KEY(ID)
); 

#5 Re: mORMot 1 » mORMot 2 - Project05HttpDaemon 64bit Error » 2022-03-08 15:46:44

Thanks,

27158 in System.pas

while P[Result] <> #0 do

log file:

20220308 15395239  " EXCOS EAccessViolation (c0000005) [] at 41265f System.pas @PWCharLen (27158)

#6 mORMot 1 » mORMot 2 - Project05HttpDaemon 64bit Error » 2022-03-08 10:59:57

augusto
Replies: 23

Hi All,

This is my first post. Thanks for the great Job! smile

I've found an issue when using  TSynDaemon in the latest mORMot2 release.
... looking at, Project Project05HttpDaemon in ...\ex\ThirdPartyDemos\martin-doyle\05-HttpDaemonORM\src as an example ...

I believe there is a bug in mORMot2 when building for 64bit and starting the project as a service.

.\Project05HttpDaemon.exe /install - OK

When starting the service, using windows services dialog, I'm getting  an error:
-----------------------------
Windows could not start the Project05HttpDaemon service on
Local Computer.

Error 1067: The process terminated unexpectedly.
-----------------------------

Log File :
...
20220308 10482210  ! info  SetThreadName 243c=Main
20220308 10482210  ! info  Daemon started, listening on port 11111
20220308 10482210  " EXCOS EAccessViolation (c0000005) [] at 41265f

Using :
Delphi 10.4 Update 2
Win 10 pro

(It is working fine when using 16 Dec 2021 release and/or 32bit in current release)

Any thoughts?

Board footer

Powered by FluxBB