Reputation: 10409
I'm having some trouble inserting a hard-coded value in to a "timestamp" field in Advantage 9.1. I want a "timestamp" field, because I want a combined date + time field. What am I doing wrong? I've tried a number of variations listed below, each fails with an error message.
create table foo(a timestamp);
insert into foo (a) values ('12/31/2012');
insert into foo (a) values (cast ('12/31/2012' as sql_timestamp));
insert into foo (a) values (cast ('2012-12-31' as sql_timestamp));
insert into foo (a) values (convert('12/31/2012', sql_timestamp));
insert into foo (a) values (convert('2012-12-31', sql_timestamp));
the incantation has got to be simple, and I'm just not getting it.
Upvotes: 2
Views: 3010
Reputation: 41252
I believe that the following will work (include the time portion of the literal and specify it as zero):
insert into foo (a) values ('2012-12-31 00:00:00')
And I think it is also possible to use an older style escape sequence with v9.x to create a date literal constant and then use the convert scalar:
insert into foo (a) values convert( {d '2012-03-04'}, sql_timestamp))
Upvotes: 2