Is there a function to extract a timespan field from a datetime2 field?
e.g
datetime2 has '01/01/2009 12:30:00'
i want '12:30:00'
Either just use the CAST function:
SELECT CAST(@datetime2var AS TIME)
or assign your "datetime2" variable to another variable of type "TIME":
DECLARE @timeVal TIME
SET @timeVal = @datetime2var
SELECT @timeVal
Marc
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With