• unfortunately at the time i published this article the data was truncated when i submitted it. unfortunately that stuff is long gone.

    basically it worked like this:

    i had a table that mapped the remote sql server (linked server) to the district id that it was associated with.

    then i had a bunch of stored procedures, one for each table that needed an import or update, in all of these stored procedures i had a districtid input parameter, which was resolved to the linked server name it belonged to by a user defined function.

    from the the dynamic sql was constructed for example:

    if district id was 1 then

    insert into localtable (columnlist plus the districtid) select (exact same column list plus the districtid) from [(linkedserverremotetable(fully qualified name))] where [(remotecriteria)] not in (sub query localtable).

    the update works similarly.

    now i had something like 200 stored procedures doing this.

    i wrapped them all up in a stored procedure that used a cursor to go through all the districtid's in the linkedsever table and execute them in order.

    when i tested it on a local environment it worked very well and it to approximately 2 minutes to import about 2 million records.

    this was my first piece of 'advanced' sql.

    if i had to do it again i would change some things slightly, and probably use other technology.

    however this logic did work, and if the technology is not avialiable (i.e you dont have enterprise licences or have older technology)

    it is a real shame that my article was truncated. it was eleven word pages long, orginally. i have lost it long ago.

    thanks

    Chris