Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Datetime variable 1

Status
Not open for further replies.

mynwo

Technical User
Jul 12, 2003
75
IN
Hi all,

I got a column datetime year to fraction(5) in my table. If i want to insert a record thru dbaccess i have to specify all the parameters, for eg.
"2003-09-09 09:09:09.12345", i have to enter year-mm-dd hh:mm:ss.fraction. Is there a way where i can only enter date & it will automatically insert the time & fraction. The env. variable today does it, but we won't be using it. Also how can i insert the same thru front-end utilities like winsql. Appreciate your reply.

Regards,

lloyd
 
Hi:

Informix has the extend keyword for extending and converting the precision of dates and datetimes. Unfortunately, it only works in a select.

This is a bit of a kludge, but it works:

Given this table:

create table "eds".testeds
(
col1 datetime year to fraction(5)
);

You can do this from dbaccess:

CREATE TEMP TABLE tb (
col1 date
) WITH NO LOG;
INSERT INTO tb VALUES ("09/09/2003");
INSERT INTO testeds
SELECT extend(col1, YEAR TO FRACTION(5) ) FROM tb;

Create a temp table with a date type; insert a value into the temp table, and then insert into your database table extending the data type.

Sorry, can't help you with winsql.

Regards,

Ed

 
Hi Ed,

Thanks for your prompt reply. Suppose if i need to insert a record thru other appln. like java then how do i do. Any suggestions.

Regards,

lloyd

 
Lloyd:

Sorry, can't help; I'm not a java programmer.

Regards,

Ed
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top