If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Informix > insert date field in a datetime field

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-17-04, 10:47
problem problem is offline
Registered User
 
Join Date: May 2004
Posts: 8
insert date field in a datetime field

Hi,
is it possible to convert a date field into a datetime field. I've got this error :

-1262 Non-numeric character in datetime or interval.

on

create procedure "informix".ins_notimportant(
p_date VARCHAR(50)) -- date parameter
DEFINE l_datetime like tablename.datetimefield;

LET l_datetime = p_date;
...

In this procedure, I have to insert a date field into a datetime field. I tried extend() but it don't seems to work... can somebody help ?

thanks
Reply With Quote
  #2 (permalink)  
Old 05-17-04, 11:00
gurey gurey is offline
Registered User
 
Join Date: Aug 2003
Location: Argentina
Posts: 780
Hi,

Please check you program or SPL.

This conversion is posible.
Consider following example:

create raw table notimportant
( colchar varchar(50)
)
insert into notimportant
select columnvarchar from anytable

This run fine.

Gustavo
Reply With Quote
  #3 (permalink)  
Old 05-17-04, 11:41
problem problem is offline
Registered User
 
Join Date: May 2004
Posts: 8
no, It don't works

I've got error -1262 when i try to put a date in a datetime variable.

when i try

Let l_datetime = l_date;
(datetime year to day) (date)

this line generates the error -1262... I can try :

SELECT extend(p_date, year to day)
INTO l_datetime
FROM dual;

Where dual have only 1 row and It gives me the same error!
Reply With Quote
  #4 (permalink)  
Old 05-17-04, 11:52
gurey gurey is offline
Registered User
 
Join Date: Aug 2003
Location: Argentina
Posts: 780
Hi,

Ok, please test with:
SELECT MDY(p_date)
INTO l_datetime
FROM dual

Gustavo.
Reply With Quote
  #5 (permalink)  
Old 05-17-04, 12:01
problem problem is offline
Registered User
 
Join Date: May 2004
Posts: 8
Red face thanks

Thanks a lot, MDY() works...
Reply With Quote
  #6 (permalink)  
Old 05-18-04, 02:46
jh1213 jh1213 is offline
Registered User
 
Join Date: Jul 2003
Location: Beijing China
Posts: 36
LET l_datetime = current;

--return OS time

--format "2004-05-18 14:58:58"
__________________
MSN:jianghua1213@hotmail.com
Beijing China
http://www.91talk.net
http://www.91talk.com
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On