I am working on a process in my applicaiton that is used to update a table in our database called
This process was originally built using SQL Server and works there. I am porting it to Sql Anywhere 12.0.1. This process is built in C#.
My problem is in the loading into the temporary table phase. Here's the code for creating the temporary table:
new SACommand( @"DROP TABLE IF EXISTS tempimport; SELECT * INTO LOCAL TEMPORARY TABLE tempimport FROM ListDetails WHERE 1 = 0;", saConnection, saTransaction ).ExecuteNonQuery();
This executes without any errors.
In SQL server, we used bulk copy to load the data. It turns out that a dedicated
SACommand insertCommand = new SACommand( "INSERT INTO tempimport " + "( ListDetailId, ListId, CountryId, LocaleCode, Plate, HashedPlate, AlarmClassId, BeginDate, EndDate, " + "ListPriorityId, VehicleTypeId, PlateClassId, MakeId, ModelId, Year, ColorId, " + "Notes, OfficerNotes, CreateDate, Subscriber, InstanceId ) " + "VALUES " + "( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ) ", saConnection, saTransaction );
The next code creates a bunch of
The problem is that when I execute the
Just to make sure it's clear, the
Just to share, the solution was to hard code the layout of the temporary table in a DDL statement, i.e.,
CREATE LOCAL TEMPORARY TABLE tempimport( . . . )
This means that I will have to update the DLL if we ever change the layout of the table. Even though the
answered 07 Feb '13, 17:18