OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
AW: Default for date fields ?????

From: Zabach, Elke (elke.zabachsap.com)
Date: Thu Feb 17 2005 - 05:51:15 CST


A.Beermannpiepenbrock.de wrote:
>
> Hello everbody
>
> In our application we show the results of an sql-select in a grid let
> let the users alter the data.
> Our users do not like. NULL. values in there application, so we define
> all tables like the following example
>
> l_sqltabneu = "create table YXZ ("+;
> "testid char(8) KEY," +;
> "testfield char(20) ASCII NOT NULL DEFAULT ' '," +;
> "testnumber FIXED(10,2) NOT NULL DEFAULT 0.00 " +;
> ")"
>
> Is it possible to define a date or datetime field with not null
default
> ' ' or '00-00-0000' ??????
> I always receive an error (invalid date format)
>

You can define a default for datatype DATE
mydate DATE DEFAULT DATE --> current date
mydate DATE DEFAULT '..........' the given date. In this case the
current date_and_time_format has to be taken into account:
http://dev.mysql.com/doc/maxdb/en/48/0d8018b4f211d2a97100a0c9449261/fram
eset.htm

Depending on the client used for specifiying this sentence is important:
The ISO date and time format is used by ODBC and JDBC applications and
cannot be replaced by a different date and time format.

As SQLStudio is an ODBC/JDBC client, you have to use the ISO
date-format.

And only real dates are allowed, starting from 1. Januar of the year 01,
month not greater than 12, day not greater then 31/30/29/28 -->
'0001-01-01' would be a good idea.

Elke
SAP Labs Berlin

> Any help welcomed
>
> Albert
>
>
> --
> MaxDB Discussion Mailing List
> For list archives: http://lists.mysql.com/maxdb
> To unsubscribe:
http://lists.mysql.com/maxdb?unsub=elke.zabachsap.com

--
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb