Those who forget the past

Why, why, why can I not remember that TIMESTAMP is a reserved work in SQL?

I've done this several times, and it's just getting stupid. At this point I feel like a complete idiot.

What happened was making up a database schema this morning and I needed a record timestamp. So I put in a column named "Timestamp". An obvious enough name. The table designer didn't complain and I didn't even think about it until ADO.NET raised a "syntax error in INSERT statement" exception when I tested my input form. So then I messed around for a while until I thought to check my column names and ended up smacking myself in the head.

The problem, of course, is twofold. First, most of the SQL I do is select queries, so I don't use the TIMESTAMP keyword very often, and hence don't think of it. Second, lots of the databases I do at work are simple, stand-alone MS-Access databases, so the easy way to design the tables is in the Access table designer. And, in the spirit of helping clueless people do blindingly stupid things, Access doesn't complain when you enter a reserved word as a column name.

Of course there's always that thing where you enclose the column name in brackets (does ADO.NET still allow that?), but I always found that sort of nonsense was best avoided. It never seemed to work the way I expected anyhow.

You can reply to this entry by leaving a comment below. You can send TrackBack pings to this URL. This entry accepts Pingbacks from other blogs. You can follow comments on this entry by subscribing to the RSS feed.

Add your comments #

A comment body is required. No HTML code allowed. URLs starting with http:// or ftp:// will be automatically converted to hyperlinks.