Linked Server question...

  • Hi...I would appreciate some guidance on the following please:

    SQL 2005 STD SP3

    linked server via ODBC to Progress 9.1E database

    requirement to replicate tables in SQL from Progress database

    when I initially run this code in SSMS it takes about 15 minutes..once run, thereafter it is virtually instant..??

    There are PK's on SAN in both databases

    DECLARE @MAX_SAN INT

    SET @MAX_SAN = (

    SELECT MAX(SAN)

    FROM SQL.SA

    )

    INSERT INTO SQL.SA ( SAN )

    SELECT SAN

    FROM PROGRESS_LINKEDSERVER..PUB.SA

    WHERE ( SAN > @MAX_SAN )

    subsequent runs are almost immediate...can someone please explain why the initial run takes so long?

    Hopefully the above makes sense !

    Regards

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • Hi...update

    solved the problem by using the variable in OPENQUERY against the linked server.

    this issue only appeared to manifest against large source tables (>1M rows)....still dont know why, but the solution is far quicker anyway.

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply