defaulting chars to be upper case
Posted in 1999
Topics: Data Types & Schema Design
Does anyone know of a way to make a field upper case?
Exampe:
create table test (
thefield varchar(10)
)
insert into test values ("test")
and have the field default to "TEST"?
Thanks in Advance
tycnine@flash.net wrote:
>
> Does anyone know of a way to make a field upper case?
>
> Exampe:
>
> create table test (
> thefield varchar(10)
> )>
> insert into test values ("test")>
> and have the field default to "TEST"?
This is not directlyu possible at the server level. You CAN add a check
constraint that will prevent lower case letters from being inserted. That
will force applications and users to insert only acceptable values. In
version 7.30+ you COULD, in theroy, have an insert trigger update the
column to UPPER(column) but that will not work in earlier versions of the
engine and I have not attempted this myself so....
Art S. Kagel
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
- --
<tycnine@flash.net> wrote in message news:37E12CC6.B2827E76@flash.net...
> Does anyone know of a way to make a field upper case?
>
> Exampe:
>
> create table test (
> thefield varchar(10)
> )>
> insert into test values ("test")>
> and have the field default to "TEST"?
>
> Thanks in Advance
>
You can write an "insert"/"update" trigger that will uppercase the
inserted/updated value.
/NL
- --
Nir Levy Email: nlevy@shaked.co.il
System Administrator Phone: +972-3-5797551/5789536
Shaked Computer Systems Ltd. Fax: +972-3-5703705
http://www.shaked.co.il/~nlevy
-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 6.5.1 for non-commercial use <http://www.pgp.com>
iQA/AwUBN+4UDdBe37AVcjAxEQJilQCdH1/xeoO3tm8l9N5EZPPgmdPsYx0An2RD
+4pPFWQtJGo1CAmeL6yzAK6U
=Pnfn
-----END PGP SIGNATURE-----