jharding08
Programmer
I have to do a data transfer between two databases. The code was already written to move data between two access MDB files. I am changing the backend database to SQL Server, which inevitably will change the SQL statement. here is the statement for two MDB's -
"UPDATE Packages P INNER JOIN " & _
"[MS Access;DATABASE=" & DatabaseFrom & ";].Packages MSP " & _
"ON MSP.PackageID = P.PackageID SET " & _
"P.TrackingNo = MSP.TrackingNo, " & _
"P.RecipientID = MSP.RecipientID, " & _
"P.PackageTypeID = MSP.PackageTypeID, " & _
"P.LocationID = MSP.LocationID, " & _
"P.CarrierID = MSP.CarrierID, " & _
"P.MailRoomID = MSP.MailRoomID, " & _
"P.ReceivedUserID = MSP.ReceivedUserID, " & _
"P.ReceivedDate = MSP.ReceivedDate, " & _
"P.DeliveredUserID = MSP.DeliveredUserID, " & _
"P.DeliveredDate = MSP.DeliveredDate, " & _
"P.DeliveryStatusID = MSP.DeliveryStatusID, " & _
"P.RecipientSignatureID = MSP.RecipientSignatureID, " & _
"P.Comments = MSP.Comments, " & _
"P.LastUpdated = NOW() " & _
"WHERE P.LastUpdated<>MSP.LastUpdated AND P.LastUpdated<MSP.LastUpdated"
When i run the execute with DATABASEFROM being the path to a UDL file pointing to the SQL Server Database, I get the error : "Syntax Error Near P". Any SQL Server experts out there?
"UPDATE Packages P INNER JOIN " & _
"[MS Access;DATABASE=" & DatabaseFrom & ";].Packages MSP " & _
"ON MSP.PackageID = P.PackageID SET " & _
"P.TrackingNo = MSP.TrackingNo, " & _
"P.RecipientID = MSP.RecipientID, " & _
"P.PackageTypeID = MSP.PackageTypeID, " & _
"P.LocationID = MSP.LocationID, " & _
"P.CarrierID = MSP.CarrierID, " & _
"P.MailRoomID = MSP.MailRoomID, " & _
"P.ReceivedUserID = MSP.ReceivedUserID, " & _
"P.ReceivedDate = MSP.ReceivedDate, " & _
"P.DeliveredUserID = MSP.DeliveredUserID, " & _
"P.DeliveredDate = MSP.DeliveredDate, " & _
"P.DeliveryStatusID = MSP.DeliveryStatusID, " & _
"P.RecipientSignatureID = MSP.RecipientSignatureID, " & _
"P.Comments = MSP.Comments, " & _
"P.LastUpdated = NOW() " & _
"WHERE P.LastUpdated<>MSP.LastUpdated AND P.LastUpdated<MSP.LastUpdated"
When i run the execute with DATABASEFROM being the path to a UDL file pointing to the SQL Server Database, I get the error : "Syntax Error Near P". Any SQL Server experts out there?