BetaRide
BetaRide

Reputation: 16894

How to add 1 millisecond to a timestamp in DB2?

I have to add 1 millisecond to a timestamp.

This is what I've tried:

SELECT cr_time+'0000-00-00 00:00:00.001' FROM foo.bar

which returns

Error: [SQL0182] A date, time, or timestamp expression not valid.
SQLState:  42816
ErrorCode: -182

I also tried:

SELECT  TIMESTAMPADD(1,1,CR_TIME) FROM foo.bar

which returns

Error: [SQL0204] TIMESTAMPADD in *LIBL type *N not found.
SQLState:  42704
ErrorCode: -204

What's the correct way to add 1 millisecond to a timestamp?

Upvotes: 3

Views: 8678

Answers (1)

BetaRide
BetaRide

Reputation: 16894

After all I found this solution:

SELECT CR_TIME + 1000 MICROSECONDS FROM foo.bar

Upvotes: 9

Related Questions