SQL MICROSECOND scalar function in DB2 for i SQL

SQL MICROSECOND scalar function in DB2 for i SQL
SQL MICROSECOND scalar function in DB2 for i SQL, sql function, db2 sql, ibmi db2
SQL MICROSECOND scalar function in DB2 for i SQL

MICROSECOND

The MICROSECOND function returns the microsecond part of a timestamp value.

Syntax

MICROSECOND(expression)

the expression must be either timestamp or character string or graphic string or numeric data type and if string then must be valid representation of the timestamp and if number then must be a timestamp duration ranges -999999 to 999999

Example

SELECT MICROSECOND('2024-03-24-10.00.00.123456'),              
   MICROSECOND(current timestamp),                             
  MICROSECOND(TIMESTAMP('3/15/2000') - TIMESTAMP('12/31/1999'))
  FROM SYSIBM.SYSDUMMY1                                        

Output

  MICROSECOND     MICROSECOND     MICROSECOND
      123,456         911,366               0

Post a Comment

© AS400 and SQL Tricks. All rights reserved. Developed by Jago Desain