MICROSECOND
Descriptionβ
Extracts the microsecond part from a datetime value. The returned range is from 0 to 999999.
Syntaxβ
MICROSECOND(<date>)
Parametersβ
Parameter | Description |
---|---|
<date> | The input datetime value, of type DATETIMEV2, with a precision greater than 0 |
Return Valueβ
Returns an INT type representing the microsecond part of the datetime value. The range is from 0 to 999999. For inputs with a precision less than 6, the missing digits are padded with zeros.
Exampleβ
SELECT MICROSECOND(CAST('1999-01-02 10:11:12.000123' AS DATETIMEV2(6))) AS microsecond;
+-------------+
| microsecond |
+-------------+
| 123 |
+-------------+