jd0000 Posted October 28, 2009 Share Posted October 28, 2009 I'm trying to create a table where I have information about a computer -- for example -- name, ip, memory, hd size. I scan client computers daily to get a report of their info which i put into a csv, then i run a script to convert that csv into SQL statements to update my database as needed. I want to only update rows where information has changed -- mainly because i need to have an "updated" timestamp on the table, so another script can look at the table and only select rows updated after timestamp XX. The problem is, since I am just parsing a csv file to create the INSERTS, i dont know if the exact data already exists in the table. I could do it differently where I do selects for each set of computer data to see if its there, but with 2000+ computers, that would take forever. Any suggestions on how to work this out? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/179361-table-data-with-updated-timestamp/ Share on other sites More sharing options...
artacus Posted October 28, 2009 Share Posted October 28, 2009 Use a staging table to import the csv and only update the ones that don't match. Quote Link to comment https://forums.phpfreaks.com/topic/179361-table-data-with-updated-timestamp/#findComment-946455 Share on other sites More sharing options...
fenway Posted October 31, 2009 Share Posted October 31, 2009 MySQL 5 has a CSV engine type. Quote Link to comment https://forums.phpfreaks.com/topic/179361-table-data-with-updated-timestamp/#findComment-948411 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.