Insert a timestamp and characters in the same column

Database
Enthusiast

Insert a timestamp and characters in the same column

Hi!

I have a weird reqmt here. I need to insert a timestamp and a fixed set of characters say 'Tera' in the same column.
and the column is varchar15.

Is there any way to do thiss?

Thnks!!
1 REPLY
Enthusiast

Re: Insert a timestamp and characters in the same column

Use column with type varchar(19).
When inserting timestamp, just cast it into varchar(19), and constant string insert "as is".
For example:
create table x(f1 varchar(19));
insert into x (f1) values (cast(current_timestamp(0) as varchar(19)));
insert into x (f1) values ('Tera');

?