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'
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
You will need something like
select convert(varchar(10), sysdate, 108)
The complete list of Date Time Functions is here : link text