Обсуждение: NULL DATE

Поиск
Список
Период
Сортировка

NULL DATE

От
"Michel \\'ZioBudda\\' Morelli"
Дата:
Hi, I have a item in a table that is a "date". I want to insert a null
value in this item. How can I make it ? Is it possible ?

A SI BIRU
--
Morelli 'ZioBudda' Davide Michel - Member of Pluto Linux User Group
michel@enter.it - http://ziobudda.enter.it/
Linux Problem? Ask to linux@media.dsi.unimi.it
"/dev/ziobudda: access to /var/tmp/beer denied, use /var/adm/pineapple"





Re: [SQL] NULL DATE

От
jwieck@debis.com (Jan Wieck)
Дата:
>
> Hi, I have a item in a table that is a "date". I want to insert a null
> value in this item. How can I make it ? Is it possible ?

    CREATE TABLE mytab (a int4, b text, c date);

    -- attribute a will have NULL value
    INSERT INTO mytab (b, c) VALUES ('something', 'now');

    -- attribute b will have NULL value
    INSERT INTO mytab (a, c) VALUES (2, 'now');

    -- attribute c will have NULL value
    INSERT INTO mytab (a, b) VALUES (3, 'something else');


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#======================================== jwieck@debis.com (Jan Wieck) #

Re: [SQL] NULL DATE

От
ZioBudda
Дата:
On Sun, 18 Oct 1998, Jan Wieck wrote:
>
>     -- attribute a will have NULL value
>     INSERT INTO mytab (b, c) VALUES ('something', 'now');

ok..
but i have the case
    INSERT INTO mytab (a,b,c) VALUES(2,'something','now');
    now i want to set NULL the date item in this tuple.

A SI BIRI
--
Italian Linux Meeting - http://www.pluto.linux.it/meeting/
--
Morelli 'ZioBudda' Davide Michel - Member of Pluto Linux User Group
michel@enter.it - http://ziobudda.enter.it/
Linux Problem? Ask to linux@media.dsi.unimi.it
"/dev/ziobudda: access to /var/tmp/beer denied, use /var/adm/pineapple"


Re: [SQL] NULL DATE

От
jwieck@debis.com (Jan Wieck)
Дата:
>
> On Sun, 18 Oct 1998, Jan Wieck wrote:
> >
> >     -- attribute a will have NULL value
> >     INSERT INTO mytab (b, c) VALUES ('something', 'now');
>
> ok..
> but i have the case
>     INSERT INTO mytab (a,b,c) VALUES(2,'something','now');
>     now i want to set NULL the date item in this tuple.
>

    INSERT INTO mytab (a, b, c) VALUES (2, 'something', NULL);

Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#======================================== jwieck@debis.com (Jan Wieck) #

RE: [SQL] NULL DATE

От
"Taral"
Дата:
> ok..
> but i have the case
>     INSERT INTO mytab (a,b,c) VALUES(2,'something','now');
>     now i want to set NULL the date item in this tuple.

either:

INSERT INTO mytab (a,b) VALUES (2,''something');

or if it exists already:

UPDATE mytab SET c = NULL;

Taral