cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to insert timestamp to sybase table using insert query?

Former Member
20,504

Hi, Please help me to write a query to insert timestamp value to Sybase table using insert query.

Regards, Bikshu.

Accepted Solutions (0)

Answers (2)

Answers (2)

chris_keating
Product and Topic Expert
Product and Topic Expert

This assumes that you are asking about SQL Anywhere and not ASE. If you are asking about timestamps in ASE, you should ask that in an ASE focused forum.

For SQL Anywhere, here is a simple example:

insert into t (ts_col) values( now() )

For ASE, you should note that a timestamp value is not a data and time value but a binary value generally used for row versioning. Its value is updated anytime a row is modified so that suggests that you likely should not be setting its value at all in a row operation - simply let the server manage that for you. You can obtain the timestamp value with @@dbts. If you are asking in an ASE context, I remind you that I am not an ASE person so you should address this in a forum that is focused on ASE.

jack_schueler
Product and Topic Expert
Product and Topic Expert

Here you go.

create table ts_table (ts timestamp);
insert into ts_table (ts) values ('2013-10-08T12:34:45.678');

Of course, I am sure that's not what you wanted to know, but it is what you asked.