Groups | Blog | Home
all groups > sql server new users > april 2005 >

sql server new users : correct way to update live table


r
4/14/2005 9:58:10 AM
I need to populate many fields in a column of a table, now that I have the
information that goes there. I can't repost the entire table with the new
data because the table is now live, underlying a website, and new records
are being added regularly. Some who are only slightly more experienced than
I have suggested some ways to go about this, but some sound fishy -- I am
interested in knowing the "correct" way to go about this.

The data can be either tab-delimited text, excel, access - I can put it
whereever I need it, or I can import the data as a table on the server.
Whatever I have to do. The new data and the existing table would be updated
correctly by the use of the unique record ID.

Again, apologies for asking something that I could probably learn by reading
a book, but I've been thrown into this project with no real SQL experience,
and time is of the essence (isn't it always?!).

Walter Clayton
4/15/2005 1:22:45 AM
Manuals are your friend, especially when under the gun. ;-)

'Correct way' depends on the business model. One issue you'll need defined
is what happens when you have data 'collision' That is, if two or more
updates are being done 'offline' against the same row from different sources
and then batched up, which takes precedence, which gets thrown away and how
do you determine that.

Setting that aside, drop the table into an intermediary table and then issue
an update where keys exists and data has changed followed by an insert where
keys don't exist. That leaves the data closest to the database engine.

--
Walter Clayton
Any technology distinguishable from magic is insufficiently advanced.


[quoted text, click to view]
AddThis Social Bookmark Button