Jump to content
Fórum Script Brasil
  • 0
Sign in to follow this  
doodoh

Como inserir dados do tipo data e tempo?

Question

Criei minha table e tentei assim, mas da erro na hora de inserir, vejam a imagem do erro lá embaixo;

CREATE TABLE Ocorrencia (
id_ocorrencia int(11) NOT NULL PRIMARY KEY,
-- data_hora datetime,
data_ocorrencia datetime ,
data_termino datetime,
tempo_duracao datetime
);
drop table ocorrencia;
CREATE TRIGGER trg_duracao BEFORE INSERT
ON Ocorrencia 
FOR EACH ROW 
SET NEW.tempo_duracao = (NEW.data_ocorrencia - data_termino);
    
INSERT INTO ocorrencia
(id_ocorrencia, data_ocorrencia, data_termino)
VALUES
('01','2017-05-25 08:30:05','2017-05-26 00:20:10');

Screenshot 2017-05-25 20.32.56.png

Edited by doodoh

Share this post


Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

Cloud Computing


  • Forum Statistics

    • Total Topics
      148438
    • Total Posts
      643881
×
×
  • Create New...