I am designing a database and recently named a column in a table DayOfWeek, completely forgetting that DayOfWeek is a built-in function in SQL Server. Now I am deciding if I should just leave it as is and reference the column with square brackets [DayOfWeek] or change the column name to avoid any conflicts in the future. I am not too far into the project so changing it is not too hard. The debate in my head is that the column name of DayOfWeek just makes so much sense for its purpose, so I really want to use it... but it is a reserved word... and could cause pain in the future (especially if I always have to put square brackets around it when referencing the column).
What does everyone think?
I would change it - i've got a legacy table called user - it is a pain with the square brackets all the time. perhaps call it DayOfWeekName or DayOFWeekId
Josh
Jeff,
If you're not too far down the track to rename the column (relatively) painlessly then I'd recommend you change it. You've identified one probable-future-headache for the maintentance crew, and I guess it would be actually less costly (over time) to clean it up now, especially considering that renaming something isn't the hell-on-wheels since the advent of truly effective search and replace functionality in text-editors and IDE's.
The truly hard part of renaming it is gaining the understanding required to do the job safely. You are unique (being the author) in having that understanding. If you asked me (just for instance) to do the job, then it probably wouldn't be a cost effective business proposition.
So... +1 for fixing the sucker yourself... and +2 for not doing it again ;-)
Cheers. Keith.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With