SQL INSERT problem

mackyrm

Registered User.
Local time
Today, 04:17
Joined
Oct 5, 2006
Messages
57
I have a rather bizarre SQL issue. I am taking data from two tables and copying it across to a third table, before deleting it. This works perfectly well until I reach the number (a key ID number) 22401 and beyond.

I have checked the casts (long) for the recipient table and in the code
I have stepped through the code and it works perfectly fine up to 22401 (id Number, actual record number is 19995), the data is still deleted with the code that follows it up - it is the transfer part of the code that fails - at 22401!

Any advice appreciated, SQL is provided below:



INSERT INTO tblDELETEDCONTACT (CompanyID, Forename, Surname, BusinessName, Address1, Address2, Address3, TownCity, Region, Postcode, Email1, KnowNetwork, LCB, KTP, BusinessGrowth, Chamber, Ezine, DateDeleted, DeletedBy, ContactID ) SELECT tblCOMPANY.CompanyID, tblCONTACT.Forename, tblCONTACT.Surname,tblCOMPANY.BusinessName,tblCOMPANY.Address1,tblCOMPANY.Address2,tblCOMPANY.Address3,tblCOMPANY.TownCity, tblCOMPANY.Region, tblCOMPANY.Postcode, tblCONTACT.Email1, tblCONTACT.KnowNetwork,tblCONTACT.LCB, tblCONTACT.KTP, tblCONTACT.BusinessGrowth,tblCONTACT.Chamber, tblCONTACT.ezine, '19/02/2008 15:42:50' ,'testname', 22401 tblCOMPANY INNER JOIN tblCONTACT ON tblCOMPANY.CompanyID = tblCONTACT.ContactID WHERE (((tblCONTACT.ContactID) =22401));
 
Perhaps if you were to try:

INSERT INTO tblDELETEDCONTACT (CompanyID, Forename, Surname, BusinessName, Address1, Address2, Address3, TownCity, Region, Postcode, Email1, KnowNetwork, LCB, KTP, BusinessGrowth, Chamber, Ezine, DateDeleted, DeletedBy, ContactID )
SELECT tblCOMPANY.CompanyID, tblCONTACT.Forename, tblCONTACT.Surname,tblCOMPANY.BusinessName,tblCOMP ANY.Address1,tblCOMPANY.Address2,tblCOMPANY.Addres s3,tblCOMPANY.TownCity, tblCOMPANY.Region, tblCOMPANY.Postcode, tblCONTACT.Email1, tblCONTACT.KnowNetwork,tblCONTACT.LCB, tblCONTACT.KTP, tblCONTACT.BusinessGrowth,tblCONTACT.Chamber, tblCONTACT.ezine, #19/02/2008 15:42:50# ,'testname', 22401
FROM tblCOMPANY INNER JOIN tblCONTACT ON tblCOMPANY.CompanyID = tblCONTACT.ContactID WHERE (((tblCONTACT.ContactID) =22401));
 
Thanks for this, I haven't had any success with this - any other suggestions?
 

Users who are viewing this thread

Back
Top Bottom