File Mover Blog

April 21, 2024

How to import data into a SQL table where a primary key as guid is needed

How to import data into a SQL table where a primary key as guid is needed

Q: I have a question about importing data into a SQL table where a primary key (guid/uniqueidentifier) needs to be generated. In a SQL command like the below, NEWID() will create the required id. Can this be achieved in Limagito?

limagito file mover sql primary key as guid

INSERT INTO dbo.testtable(intconID, caseID)

VALUES (NEWID(), 1)

Error received:

8/04/2024 12:37:55 PM TFDPhysMSSQLCommand DB SQL Exception: [FireDAC][Phys][ODBC][Microsoft][ODBC SQL Server Driver][SQL Server]Cannot insert the value NULL into column ‘intconID’, table ‘dbo.TestTable’; column does not allow nulls. INSERT fails.

8/04/2024 12:37:55 PM Batch Move Exception: [FireDAC][Phys][ODBC][Microsoft][ODBC SQL Server Driver][SQL Server]Cannot insert the value NULL into column ‘intconID’, table ‘ dbo.TestTable ‘; column does not allow nulls. INSERT fails.

A: We added a new feature in version v2024.4.9.0 which replaces the NEWID() in the WriteSQL by a GUID when the Rule is triggered.

If you need any help with this ‘primary key as guid’ request, please let us know.

Best Regards,

Limagito Team

#sql #managedfiletransfer #FileManagement #filetransfer

By Limagito-Team SQL , , , Share:
SEARCH