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
All content Copyright ©2010 David Braverman. The Daily Parker by David Braverman is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 United States License, excluding photographs, which may not be republished unless otherwise noted.
Disclaimer This blog contains the personal opinions of David Braverman and, where applicable, guest bloggers.
The ParkerCam may return, but until it does, it's still a good photo of him.