Re: Column naming convention good or bad?

From: <MSherrill_at_compuserve.com>
Date: Thu, 16 Nov 2000 18:00:40 GMT
Message-ID: <3a141b0c.96565553_at_news.compuserve.com>


On Tue, 14 Nov 2000 22:26:25 -0500, "Ali Tajdari" <tajdaria_at_nettally.com> wrote:

>My company is developing an SQL coding conventions document. We are
>currently considering using a three letter prefix for column names. The
>prefix would indicate the columns data type. Has anyone applied this type
>of standard before and was it useful? Is this naming convention bad?

Yes, it's bad. Think about what happens when a column changes type from integer to long. If you prefixed it with "int", you have to change it to "lng".

Now your views don't work, because they're looking for "int". Any client software that's based on those views breaks, too.

So you have to either fix the views, or alias the column (as in "SELECT lngBadIdea AS intBadIdea...").

If you had prefixed the column name with "num" instead of "int", you wouldn't have to fix the views. But you couldn't tell what type it was, either.

On top of all that, it reveals storage-level details--one of the things relational systems are supposed to hide from us.

-- 
Mike Sherrill
Information Management Systems
Received on Thu Nov 16 2000 - 19:00:40 CET

Original text of this message