Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2012
    Posts
    3

    Unanswered: Best practice to update a table

    I know just enough about databases to have figures out I have out grown my spreadsheets

    I would like to know the best way to write one T-SQL query to initially fill at table and subsequently update it.

    I am dumping the contents of my DNS server and importing it into a table (time_stamp,host_name,ip_address). My DNS is dynamic so a host could in theory have a different address every day. I am not interested in keeping any kind of history, just the address a host had at the time of the dump.

    Would I be better off/faster just to drop the table and rebuild it every time?

    Thanks,
    Ed

  2. #2
    Join Date
    Nov 2004
    Posts
    1,427
    Provided Answers: 4
    Would I be better off/faster just to drop the table and rebuild it every time?
    After you have dropped your table, where would you get the new data from to reload it?

    What would be the gain to put your data in a database, but keep it up to date in another system? You might just as well print everything on paper and next throw all the pages away.

    I think what you need is
    1) a way to do a one time import of your current data from Excel in a MSSQL table
    2) have software that will allow you to manage that table (create, delete and update DNS entries) from that time on, so you don't need your Excel spreadsheet any more
    3) all processes that now use your excel spreadsheet will have to be adjusted to get their data from MSSQL.
    With kind regards . . . . . SQL Server 2000/2005/2012
    Wim

    Grabel's Law: 2 is not equal to 3 -- not even for very large values of 2.
    Pat Phelan's Law: 2 very definitely CAN equal 3 -- in at least two programming languages

  3. #3
    Join Date
    Jan 2012
    Posts
    3
    I am pushing out application(s) the steps are
    extracting the current data from DNS
    putting the info into a database
    querying out the host names with an IP address beginning with 10.
    checking to see if the machine already has the application (logging table)
    if not checking to see if the machine is online
    pushing out an application to it
    logging the push to the logging table

    The logging table is of course maintained
    The DNS table is really only good for the current run as the addresses are dynamic

    So I guess the question would be is it more efficient for me do some kind up update on the DNS table or simply truncate|drop it and re-create|populate it.

    Thanks!

  4. #4
    Join Date
    Nov 2004
    Posts
    1,427
    Provided Answers: 4
    Code:
    So I guess the question would be is it more efficient for me do some kind up update on the DNS table or simply truncate|drop it and re-create|populate it.
    Maintaining the data will be done outside MSSQL.
    You have two options: performing a MERGE of the current DNS data with the MSSQL data or TRUNCATE the MSSQL table and reload it.

    Based on your information, I would give the TRUNCATE and repopulate a try. It is the fastest and easiest way.
    With kind regards . . . . . SQL Server 2000/2005/2012
    Wim

    Grabel's Law: 2 is not equal to 3 -- not even for very large values of 2.
    Pat Phelan's Law: 2 very definitely CAN equal 3 -- in at least two programming languages

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •