Re: SQL Humor

From: Mikito Harakiri <mikharakiri_nospaum_at_yahoo.com>
Date: 19 Aug 2005 15:11:14 -0700
Message-ID: <1124489474.385537.312510_at_g49g2000cwa.googlegroups.com>


AK wrote:
> >>
> >>> In fact, those ugly length
> >limited datatypes are just artifacts of the early SQL days,
> ><<
>
> >on the contrary, it is a very powerful tool in enforsing data integrity
>
>
>
> Oh? How?
> <<
>
> by declaring STATE_CODE CHAR(2) I don't let old style abbreviations
> 'Fla' and 'Ill' in
>
> by declaring COUNTRY_CODE CHAR(3), etc.

Why not

CHECK CONSTRAINT(LENGTH(COUNTRY_CODE)<=2)

BTW, this way you could also declare that COUNTRY_CODE has exactly 2 characters. Received on Sat Aug 20 2005 - 00:11:14 CEST

Original text of this message