Error: Getting an error near time format while inserting.
Example:
--Table "Test"
create table test
(
name varchar(10),
date1 timestamp,
time1 timestamp
);
-- Insertion
insert into test values('xyz','03/03/2014','02:03:04');
The type 'timestamp' holds both a time and a date. You are trying to insert the date and time separately. Either use date and time types:
--Table "Test"
create table test
(
name varchar(10),
date1 date,
time1 time
);
-- Insertion
insert into test values('xyz','03/03/2014','02:03:04');
Or, just use one field:
--Table "Test"
create table test
(
name varchar(10),
datetime timestamp
);
-- Insertion
insert into test values('xyz','03/03/2014 02:03:04');
I recommend this second approach, as the set of operators and functions available is much larger and it is easier to compare timestamps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With