Find the answer to your Linux question:
Results 1 to 2 of 2
Hi there, I'm trying to put time into a script. The time is results of olympic events. Here is some examples of my script: create table Results ( EventID char ...
  1. #1
    Just Joined!
    Join Date
    Feb 2006
    Posts
    17

    How do i put time in a script (olympicResults)

    Hi there,

    I'm trying to put time into a script. The time is results of olympic events.

    Here is some examples of my script:

    create table Results (
    EventID char (4) not null,
    CompetitorNum numeric (3) not null,
    ElapsedTime TIME not null,
    Place numeric (4) not null,
    CONSTRAINT results_competitornum_fk FOREIGN KEY (competitornum) references Competitors
    (CompetitorNum),
    constraint Results_EventComp_pk Primary Key (EventID, CompetitorNum)
    );


    insert into Results values
    ('S001',132, TIME '4:50.05', 1);
    insert into Results values
    ('S001', 166, TIME '54:88',2);

    I can put the top line in values in the script and it runs okay but when I add more I get this message:

    ERROR: invalid input syntax for type time: "4:50.05"
    SQL state: 22007


    Thanks, your help is most welcome

    Michelle

  2. #2
    Linux Enthusiast
    Join Date
    Aug 2006
    Posts
    631
    I don't know the syntax of the sql of your database to insert the time value but is "TIME" a sort of type casting?
    If not try to insert the values without the word TIME:

    Code:
    insert into Results values
    ('S001', 132, '4:50.05', 1);
    insert into Results values
    ('S001', 166, '54:88', 2);
    Regards

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...