This is a multi-part message in MIME format.
------_=_NextPart_001_01C89A36.F5A4C515
Content-Type: text/plain;
charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable
Hi Paul,
=20
That's totally what I want...
create table test_date(
an_int integer not null not default,=20
a_date timestamp(6) with local time zone not null with
default local_timestamp
)\g
insert into test_date (an_int) values (1)\g
select * from test_date\g
yields:...an_int =3D1 and a_date=3D 2008-04-09 12:40:59.830000
=20
Thanks heaps.
=20
Marty
From: info-ingres-bounces@[EMAIL PROTECTED]
On Behalf Of Paul
Mason
Sent: 09 April 2008 12:08
To: Ingres and related product discussion forum
Subject: Re: [Info-Ingres] ansidate('now')
=20
The following system constants can be used:
CURRENT_DATE=20
CURRENT_TIME
CURRENT_TIMESTAMP
LOCAL_TIME
LOCAL_TIMESTAMP
The difference between the LOCAL* and CURRENT* is that CURRENT* ones are
with timezone and LOCAL* are without.
>From what you've written it looks like what you're after is
LOCAL_TIMESTAMP:
sql iidbdb | cat
INGRES TERMINAL MONITOR Copyright 2007 Ingres Corporation
Ingres 2006 Release 2 Linux Version II 9.1.0 (a64.lnx/123)NPTL login
Wed Apr 9 11:05:24 2008
continue
* select local_timestamp\g
Executing . . .
+---------------------------------------+
|col1 |
+---------------------------------------+
|2008-04-09 11:05:31.003000001 |
+---------------------------------------+
(1 row)
continue
* \q
Ingres 2006 Release 2 Version II 9.1.0 (a64.lnx/123)NPTL logout
Wed Apr 9 11:05:33 2008
The resolution of the fractional second part (i.e. whether you really
get nanoseconds) is up to the resolution of the system clock. So as you
can see, barring some rounding, I'm getting milliseconds.
HTH
Paul
On 09/04/2008, Martin Bowes <martin.bowes@[EMAIL PROTECTED]
> wrote:
Hi Everyone,
=20
What is the ansidate equivalent of 'now'?
=20
I'm trying to store data in a table and I need the time of storage to be
as unique as possible. The nanosecond capacity of ansidate seemed to be
the way to go. But I cant create an andsidate column with default 'now'.
=20
Furthermore, the only thing I have found is: select
timestamp_local(date('now'))\g
Trouble is, the ingresdate 'now' has no sub second capacity, and so the
returned time always has seconds.000000000.
=20
The table in question has been in existence for a long time and the
applications around it have already been built so I need something that
can be retro-fitted transparently if possible.
=20
Martin Bowes
_______________________________________________
Info-Ingres mailing list
Info-Ingres@[EMAIL PROTECTED]
Mason=20
------_=_NextPart_001_01C89A36.F5A4C515
Content-Type: text/html;
charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable
<html xmlns:v=3D"urn:schemas-microsoft-com:vml" =
xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml"
=
xmlns=3D"http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dus-ascii">
<meta name=3DGenerator content=3D"Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@[EMAIL PROTECTED]
15 5 2 2 2 4 3 2 4;}
@[EMAIL PROTECTED]
11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p
{mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
span.gmailquote
{mso-style-name:gmail_quote;}
span.sg
{mso-style-name:sg;}
span.EmailStyle20
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
..MsoChpDefault
{mso-style-type:export-only;}
@[EMAIL PROTECTED]
Section1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.Section1
{page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=3DEN-GB link=3Dblue vlink=3Dpurple>
<div class=3DSection1>
<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Hi Paul,<o:p></o:p></span></p>
<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>That’s totally what I =
want…<o:p></o:p></span></p>
<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>create table test_date(<o:p></o:p></span></p>
<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'> &nbs=
p; an_int
integer not null not default, <o:p></o:p></span></p>
<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'> &nbs=
p; a_date
timestamp(6) with local time zone not null with default =
local_timestamp<o:p></o:p></span></p>
<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'> &nbs=
p; )\g<o:p></o:p></span></p>
<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>insert into test_date (an_int) values =
(1)\g<o:p></o:p></span></p>
<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>select * from test_date\g<o:p></o:p></span></p>
<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>yields:…an_int =3D1 and a_date=3D</span> <span
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497=
D'>2008-04-09
12:40:59.830000<o:p></o:p></span></p>
<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Thanks heaps.<o:p></o:p></span></p>
<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Marty<o:p></o:p></span></p>
<div style=3D'border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt =
0cm 0cm 0cm'>
<p class=3DMsoNormal><b><span lang=3DEN-US =
style=3D'font-size:10.0pt;font-family:
"Tahoma","sans-serif"'>From:</span></b><span lang=3DEN-US =
style=3D'font-size:10.0pt;
font-family:"Tahoma","sans-serif"'> =
info-ingres-bounces@[EMAIL PROTECTED]
<b>On Behalf Of =
</b>Paul
Mason<br>
<b>Sent:</b> 09 April 2008 12:08<br>
<b>To:</b> Ingres and related product discussion forum<br>
<b>Subject:</b> Re: [Info-Ingres] ansidate('now')<o:p></o:p></span></p>
</div>
<p class=3DMsoNormal><o:p> </o:p></p>
<p class=3DMsoNormal style=3D'margin-bottom:12.0pt'>The following system =
constants
can be used:<br>
<br>
CURRENT_DATE <br>
CURRENT_TIME<br>
CURRENT_TIMESTAMP<br>
LOCAL_TIME<br>
LOCAL_TIMESTAMP<br>
<br>
The difference between the LOCAL* and CURRENT* is that CURRENT* ones are =
with
timezone and LOCAL* are without.<br>
<br>
>From what you've written it looks like what you're after is =
LOCAL_TIMESTAMP:<br>
<br>
sql iidbdb | cat<br>
INGRES TERMINAL MONITOR Copyright 2007 Ingres Corporation<br>
Ingres 2006 Release 2 Linux Version II 9.1.0 (a64.lnx/123)NPTL login<br>
Wed Apr 9 11:05:24 2008<br>
<br>
continue<br>
* select local_timestamp\g<br>
Executing . . .<br>
<br>
<br>
+---------------------------------------+<br>
|col1 &n=
bsp; &nb=
sp;
|<br>
+---------------------------------------+<br>
|2008-04-09 =
11:05:31.003000001
|<br>
+---------------------------------------+<br>
(1 row)<br>
continue<br>
* \q<br>
Ingres 2006 Release 2 Version II 9.1.0 (a64.lnx/123)NPTL logout<br>
Wed Apr 9 11:05:33 2008<br>
<br>
The resolution of the fractional second part (i.e. whether you really =
get
nanoseconds) is up to the resolution of the system clock. So as you can =
see,
barring some rounding, I'm getting milliseconds.<br>
<br>
HTH<br>
Paul<o:p></o:p></p>
<div>
<p class=3DMsoNormal><span class=3Dgmailquote>On 09/04/2008, <b>Martin =
Bowes</b>
<<a =
href=3D"mailto:martin.bowes@[EMAIL PROTECTED]
">martin.bowes@[EMAIL PROTECTED]
>=
>
wrote:</span><o:p></o:p></p>
<div>
<div>
<p>Hi Everyone,<o:p></o:p></p>
<p> <o:p></o:p></p>
<p>What is the ansidate equivalent of 'now'?<o:p></o:p></p>
<p> <o:p></o:p></p>
<p>I'm trying to store data in a table and I need the time of storage to =
be as
unique as possible. The nanosecond capacity of ansidate seemed to be the =
way to
go. But I cant create an andsidate column with default =
'now'.<o:p></o:p></p>
<p> <o:p></o:p></p>
<p>Furthermore, the only thing I have found is: select
timestamp_local(date('now'))\g<o:p></o:p></p>
<p>Trouble is, the ingresdate 'now' has no sub second capacity, and so =
the
returned time always has seconds.000000000.<o:p></o:p></p>
<p> <o:p></o:p></p>
<p>The table in question has been in existence for a long time and the
applications around it have already been built so I need something that =
can be
retro-fitted transparently if possible.<o:p></o:p></p>
<p> <o:p></o:p></p>
<p>Martin Bowes<o:p></o:p></p>
</div>
</div>
<p class=3DMsoNormal style=3D'margin-bottom:12.0pt'><br>
_______________________________________________<br>
Info-Ingres mailing list<br>
<a =
href=3D"mailto:Info-Ingres@[EMAIL PROTECTED]
">Info-Ingres@[EMAIL PROTECTED]
><br>
<a =
href=3D"http://www.kettleriverconsulting.com/mailman/listinfo/info-ingres=
"
target=3D"_blank">http://www.kettleriverconsulting.com/mailman/listinfo/i=
nfo-ingres</a><o:p></o:p></p>
</div>
<p class=3DMsoNormal><br>
<br clear=3Dall>
<br>
-- <br>
Paul Mason <o:p></o:p></p>
</div>
</body>
</html>
------_=_NextPart_001_01C89A36.F5A4C515--


|