First, I picked up my new bike yesterday. But that's not the subject of this post.
No, the unfortunate real subject of this post is, "I am stupid."
I had to import about 3.5 million data points recently, and now that I'm using the data, I discovered that this quick-and-dirty construct was dirtier than it was quick. See if you can spot the problem:
const string sqlTemplate = "INSERT INTO data_points (foreign_key_id,year_num,payment,cost) VALUES ({0},{1},{2},{3})"; ... foreach (CustomStruct item in someObject.someList.Values) { string sql = string.Format(sqlTemplate, parent.RowId, item.Year, item.Cost, item.Payment); ... }
That is why I am now executing SQL statements that look like this:
ALTER TABLE items ADD swap decimal(10,2) GO UPDATE items SET swap = cost GO UPDATE items SET cost = payment GO etc.
I am now waiting for the SQL to run.
dasBlog theme by Mads Kristensen
Watch Parker, um, sleep whenever I remember to point the camera at him. Updated every 60 seconds.
Only 144 days, 11 hours, and 55 minutes remain in the worst presidency in American history.
All content Copyright ©2008 David Braverman. All rights reserved.
Disclaimer This blog contains the personal opinions of David Braverman and, where applicable, guest bloggers.