How to get current datetime in SPs
Posted in 2005
Topics: Stored Procedures & SPL
I would like the Informix Gurus to confirm if it is alright to use the following in a stored procedure to get current datetime.... select dbinfo('utc_to_datetime',sh_curtime) as current from sysmaster:sysshmvals I found this on google:comp.databases.informix and it does work. I just want to get a comfort feeling before I introduce this to the developers. thanks, Shehla -----Original Message----- From: forum.subscriber@iiug.org [mailto:forum.subscriber@iiug.org]On Behalf Of ANTHONY Sent: Wednesday, July 13, 2005 11:21 AM To: ids@iiug.org Subject: general index question [5412] I have a question about indexes in general. We have several tables that have an index, say, on columns a,b,c then an index on a, or an index on a,b. It has always been my understanding that the second index is redundant as the first index can be used to satisfy queries on a, or a,b. Is this correct? Is there any reason to duplicate the indices like this?
hi,
yes it works without the dash in column cu-rtime.
some other suggestions :
> select first 1 current from systables ;2005-07-15 09:20:11.000
or with specification
> select first 1 current year to second from systables ;2005-07-15 09:20:54
more suggestions on date and time :
http://gethelp.devx.com/techtips/info_pro/10min/10min1000/10min1000-2.asp
-----Original Message-----
From: nobody@ace.iiug.org [mailto:nobody@ace.iiug.org]
Sent: 15 July 2005 02:05
To: ids@iiug.org
Subject: How to get current datetime in SPs [5433]
I would like the Informix Gurus to confirm if it is alright to use the
following in a stored procedure to get current datetime....
select dbinfo('utc_to_datetime',sh_cu-rtime) as current from
sysmaster:sysshmvals
I found this on google:comp.databases.informix and it does work. I just want
to get a comfort feeling before I introduce this to the developers.
thanks,
Shehla
-----Original Message-----
From: forum.subscriber@iiug.org [mailto:forum.subscriber@iiug.org]On
Behalf Of ANTHONY
Sent: Wednesday, July 13, 2005 11:21 AM
To: ids@iiug.org
Subject: general index question [5412]
I have a question about indexes in general. We have several tables that
have an index, say, on columns a,b,c then an index on a, or an index on
a,b. It has always been my understanding that the second index is redundant
as the first index can be used to satisfy queries on a, or a,b. Is this
correct? Is there any reason to duplicate the indices like this?
------_=_NextPart_001_01C58918.D701D890
Content-Type: text/html
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2653.12">
<TITLE>RE: How to get current datetime in SPs [5433] </TITLE>
</HEAD>
<BODY>
<P><FONT SIZE=3D2>hi,</FONT>
</P>
<BR>
<P><FONT SIZE=3D2>yes it works without the dash in column =
cu-rtime.</FONT>
<BR><FONT SIZE=3D2>some other suggestions :</FONT>
</P>
<P><FONT SIZE=3D2>> select first 1 current from systables =
;</FONT>
<BR><FONT SIZE=3D2>2005-07-15 09:20:11.000</FONT>
</P>
<P><FONT SIZE=3D2>or with specification</FONT>
<BR><FONT SIZE=3D2>> select first 1 current year to second from =
systables ;</FONT>
<BR><FONT SIZE=3D2>2005-07-15 09:20:54</FONT>
</P>
<P><FONT SIZE=3D2>more suggestions on date and time : <A =
HREF=3D"http://gethelp.devx.com/techtips/info_pro/10min/10min1000/10min1=
000-2.asp" =
TARGET=3D"_blank">http://gethelp.devx.com/techtips/info_pro/10min/10min1=
000/10min1000-2.asp</A></FONT>
</P>
<P><FONT SIZE=3D2>-----Original Message-----</FONT>
<BR><FONT SIZE=3D2>From: nobody@ace.iiug.org [<A =
HREF=3D"mailto:nobody@ace.iiug.org">mailto:nobody@ace.iiug.org</A>] =
</FONT>
<BR><FONT SIZE=3D2>Sent: 15 July 2005 02:05</FONT>
<BR><FONT SIZE=3D2>To: ids@iiug.org</FONT>
<BR><FONT SIZE=3D2>Subject: How to get current datetime in SPs [5433] =
</FONT>
</P>
<P><FONT SIZE=3D2>I would like the Informix Gurus to confirm if it is =
alright to use the following in a stored procedure to get current =
datetime....</FONT></P>
<P><FONT SIZE=3D2>select dbinfo('utc_to_datetime',sh_cu­rtime) as =
current from sysmaster:sysshmvals </FONT>
</P>
<P><FONT SIZE=3D2>I found this on google:comp.databases.informix and it =
does work. I just want to get a comfort feeling before I introduce this =
to the developers.</FONT></P>
<P><FONT SIZE=3D2>thanks,</FONT>
<BR><FONT SIZE=3D2>Shehla</FONT>
</P>
<P><FONT SIZE=3D2>-----Original Message-----</FONT>
<BR><FONT SIZE=3D2>From: forum.subscriber@iiug.org [<A =
HREF=3D"mailto:forum.subscriber@iiug.org">mailto:forum.subscriber@iiug.o=
rg</A>]On</FONT>
<BR><FONT SIZE=3D2>Behalf Of ANTHONY</FONT>
<BR><FONT SIZE=3D2>Sent: Wednesday, July 13, 2005 11:21 AM</FONT>
<BR><FONT SIZE=3D2>To: ids@iiug.org</FONT>
<BR><FONT SIZE=3D2>Subject: general index question [5412] </FONT>
</P>
<BR>
<P><FONT SIZE=3D2>I have a question about indexes in general. We =
have several tables that have an index, say, on columns a,b,c =
then an index on a, or an index on a,b. It has always been my =
understanding that the second index is redundant as the first index can =
be used to satisfy queries on a, or a,b. Is this correct? =
Is there any reason to duplicate the indices like this?</FONT></P>
<BR>
</BODY>
</HTML>
------_=_NextPart_001_01C58918.D701D890--
Hi
To get the current time, I would use the following sql
select current
from systables
where tabid = 1;
Kind regards
Laila Holt Larsen
mailto:lhl@djoef.dk
The Association of Danish Lawyers and Economists
IT-department
+45 33959944
-----Oprindelig meddelelse-----
Fra: forum.subscriber@iiug.org [mailto:forum.subscriber@iiug.org] På vegne af
SHEHLA ARSHAD
Sendt: 15. juli 2005 02:05
Til: ids@iiug.org
Emne: How to get current datetime in SPs [5433]
I would like the Informix Gurus to confirm if it is alright to use the
following in a stored procedure to get current datetime....
select dbinfo('utc_to_datetime',sh_curtime) as current from
sysmaster:sysshmvals
I found this on google:comp.databases.informix and it does work. I just want
to get a comfort feeling before I introduce this to the developers.
thanks,
Shehla
-----Original Message-----
From: forum.subscriber@iiug.org [mailto:forum.subscriber@iiug.org]On
Behalf Of ANTHONY
Sent: Wednesday, July 13, 2005 11:21 AM
To: ids@iiug.org
Subject: general index question [5412]
I have a question about indexes in general. We have several tables that have
an index, say, on columns a,b,c then an index on a, or an index on a,b. It has
always been my understanding that the second index is redundant as the first
index can be used to satisfy queries on a, or a,b. Is this correct? Is there
any reason to duplicate the indices like this?
Laila,
Your solution works fine outside of a stored procedure but if you called it
multiple times from within a stored procedure you would get the same answer
each time. The value would be from the time that the stored procedure was
entered.
Shehla,
We use that method frequently with no problems.
David
-----Original Message-----
From: forum.subscriber@iiug.org [mailto:forum.subscriber@iiug.org] On Behalf
Of Laila Holt ....
Sent: Thursday, August 25, 2005 7:33 AM
To: ids@iiug.org
Subject: SV: How to get current datetime in SPs [5667]
Hi
To get the current time, I would use the following sql
select current
from systables
where tabid = 1;
Kind regards
Laila Holt Larsen
mailto:lhl@djoef.dk
The Association of Danish Lawyers and Economists
IT-department
+45 33959944
-----Oprindelig meddelelse-----
Fra: forum.subscriber@iiug.org [mailto:forum.subscriber@iiug.org] På vegne af
SHEHLA ARSHAD
Sendt: 15. juli 2005 02:05
Til: ids@iiug.org
Emne: How to get current datetime in SPs [5433]
I would like the Informix Gurus to confirm if it is alright to use the
following in a stored procedure to get current datetime....
select dbinfo('utc_to_datetime',sh_curtime) as current from
sysmaster:sysshmvals
I found this on google:comp.databases.informix and it does work. I just want
to get a comfort feeling before I introduce this to the developers.
thanks,
Shehla
Informix stores the current time at the beginning of the SP. You may have to
have your SP call a shell script that writes the time to a file you can read
into the SP, say into a temp table.
--EEM
> -----Original Message-----
> From: Link, David.... [mailto:DALink@west.com]
> Sent: Thursday, August 25, 2005 8:56 AM
> To: ids@iiug.org
> Subject: RE: How to get current datetime in SPs [5668]
>
> Laila,
>
> Your solution works fine outside of a stored procedure but if you called
> it multiple times from within a stored procedure you would get the same
> answer each time. The value would be from the time that the stored
> procedure was entered.
>
> Shehla,
>
> We use that method frequently with no problems.
>
> David
>
> -----Original Message-----
> From: forum.subscriber@iiug.org [mailto:forum.subscriber@iiug.org] On
> Behalf Of Laila Holt ....
> Sent: Thursday, August 25, 2005 7:33 AM
> To: ids@iiug.org
> Subject: SV: How to get current datetime in SPs [5667]
>
> Hi
>
> To get the current time, I would use the following sql
>
> select current
> from systables
> where tabid = 1;>
> Kind regards
> Laila Holt Larsen
> mailto:lhl@djoef.dk
> The Association of Danish Lawyers and Economists
> IT-department
> +45 33959944
>
>
> -----Oprindelig meddelelse-----
> Fra: forum.subscriber@iiug.org [mailto:forum.subscriber@iiug.org] På vegne
> af SHEHLA ARSHAD
> Sendt: 15. juli 2005 02:05
> Til: ids@iiug.org
> Emne: How to get current datetime in SPs [5433]
>
>
> I would like the Informix Gurus to confirm if it is alright to use the
> following in a stored procedure to get current datetime....
>
> select dbinfo('utc_to_datetime',sh_curtime) as current from
> sysmaster:sysshmvals
>
> I found this on google:comp.databases.informix and it does work. I just
> want to get a comfort feeling before I introduce this to the developers.
>
> thanks,
> Shehla
>
>