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.