Wednesday, June 23, 2010

Things I'd Like To See, #765

I'd like to be able to put attributes (à la .Net) on Sql Server columns.  I'd like to be able to flag certain columns so as to indicate that these columns with the name UserId that relate to the master User table are for change tracking, as opposed to other columns called UserId that relate to the User table but might be part of security or personnel records.

Why do I want this?  So that I can run queries to ensure that standard columns all have standard definitions.  Standards are only standards if they're enforced, after all.

This came up because I stumbled upon a standard column with some non-standard characteristics today, and had to write a change script.  If we had an equivalent to FxCop that we could apply to table definitions and stored procedures, we could keep an eye on these things and catch them before they got to production.  Being able to run a metadata query to ensure that all columns with the attribute "TrackingUserId" had a certain definition would be a good start.

(Before you suggest it, let me say that I know we could probably simulate this with extended properties.  If I were staying longer on this project, I might try to implement that.)

0 Comments:

Post a Comment

<< Home