copy data to SQL Server by checking (available)

  • Hello,

    I connect from SQL Server on Windows 2000 to Progress

    Database on UNIX.

    The database name of SQL Server is cstarsql and the

    name is cstarint on UNIX.

    I would like to schedule to copy data from

    cstarint(Progress) to cstarsql(SQLServer). I did for

    one time, but I want to control if the data has

    already copied or not. If not, it will copy.

    In DTS Query Builder to copy from Progress to SQL

    Server,

    SELECT * from calls WHERE call_date = TODAY

    The name of table of calls is the same for both

    database.The above calls is cstarint(Progress

    Database)

    This command is enough for one time. But I need to

    control if the record has already copied.

    In SQL Server, I control if the record is available or

    not with @@FETCH_STATUS .

    Now I would like to mix two queries, but I couldn't.

    Can anybody do this?

    DECLARE calls_cursor SCROLL CURSOR

    FOR SELECT * FROM calls

    WHERE call_date = TODAY

    OPEN calls_cursor

    -- Perform the first fetch.

    FETCH NEXT FROM calls_cursor

    -- Check @@FETCH_STATUS to see if there are any more

    rows to fetch.

    WHILE @@FETCH_STATUS = 0

    BEGIN

    -- This is executed as long as the previous fetch

    succeeds.

    FETCH NEXT FROM calls_cursor

    END

    CLOSE calls_cursor

    DEALLOCATE calls_cursor

  • When you say you'd like to mix the two queries, I'm thinking you want to take all the rows in SQL Server that aren't found in the progress database and insert them. Is this correct? How are you currently inserting into the Progress database? I admit I have no experience with it, which is why I ask. Are you issuing standard SQL commands such as INSERT?

    K. Brian Kelley

    bk@warpdrivedesign.org

    http://www.sqlservercentral.com/columnists/bkelley/

    K. Brian Kelley
    @kbriankelley

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

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