View Single Post
  #1  
Old 2nd December 2014, 06:27 AM
kts kts is offline
Junior Member
 
Join Date: May 2013
Posts: 12
Default INSERT INTO add each record twice

Hi,

I am using INSERT INTO from TnxQuery to copy from one table to another. The result always add each record twice. When I execute the exact same SQL INSERT INTO queries from Nexus DB Enterprise Manager(on the same tables created from code), it works without adding the records twice. Is this a bug, or is it my setup of the nexus components that is wrong..?

I avoided the problem for some time by replacing the following query:

Code:
INSERT INTO DestTable SELECT * FROM SrcTable
with:
Code:
INSERT INTO DestTable SELECT * FROM SrcTable t1 WHERE NOT EXISTS(SELECT ID FROM DestTable t2 WHERE t2.ID = t1.aID)
But now I need more advance INSERT INTO queries and cannot do this to avoid the problem.

I am using NexusDB: 4,0006 Release (C20) 32bit on RAD Studio XE6 (C++), Windows 8.1.