Jump to content

Updating Table

- - - - -

  • Please log in to reply
2 replies to this topic

#1
iwrk4dedpr

iwrk4dedpr

    Newbie

  • Members
  • Pip
  • 3 posts
I have access to a virtual instance of MS SQL Server 2005.

In the database I typically on keep "current" information that is exported by my companies main frame. Hence, on some tables once each hour they pump out a CSV extract and I take that extract and put it back into a database. My question is this.


The database can not see the network, and I do not have access to put text files on the "hard drive" of the server. So what I have to do is create a reader to send the data to the table typically I use ADO objects and use either EXCEL or Access as the front end... Depending on who uses the file it becomes their frontend to the data as well as the program which updates the database.


When I import the data I will have the old dataset in the table and increasing amounts of new data. Then when the new information is put in I delete the old information out. How do I prevent queries from using the wrong data set. I try.. when I make the updater to remember to put a "FLAG" value in and set it last and deleted the old flag value first. I wonder is that the best way? Or should I create a TEMP table populate it.. then use a stored procedure to delete the old and copy the new in?


I'm getting better ... and this is my first question so... Go easy on the nooob jokes LOL.

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
What if you add an extra column that's a date-time and have it do a default value of now() (not sure it's possible, but an idea).
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
iwrk4dedpr

iwrk4dedpr

    Newbie

  • Members
  • Pip
  • 3 posts
I've just done that... Added a "RecordOpen" int field. Can only query on a value of "1"

During the update. New records have "0" and old records have "1" then delete the "1"s and change 0's to 1's

Just thought there was a "MORE PROPER" method.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users