Update Tables

  • I am just getting started with SQL7 and need to know how to update a table. My tables are sales history imported from flat fixed length text files. Each week another week of sales needs to be appended to the current table. Once a month we do what we call "re-costing" and I will need to replace and/or add new rows for adjustments in the previous months data.

    Ed Payne


    Ed Payne

  • Ed,

    There are several options:

    BULK INSERT - TSQL

    BCP - command line utility program

    Bulk Insert Task in Database Transformation Services - graphical extension to sql.

    Transform Data in Database Transformation Services - same

    Each of these has coverage in SQL Server Books OnLine (BOL). In my case, for situations where the data doesn't need cleaning, I find that BULK INSERT works really quickly, but if you need to modify the data on a row by row basis, the Transform Data task with an Active X script works well.

    Paul Ibison

    email: Paul.Ibison@btinternet.com


    Paul Ibison
    Paul.Ibison@replicationanswers.com

  • I agree with Paul for inserts.

    Personally, for update/insert items, I import using DTS or BCP into a staging table and then update the "live" table by joining to the staging table and makeing the changes. I then delete the matching rows from the staging table and insert the remaining rows into the "live" table.

    Steve Jones

    steve@dkranch.net

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

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