declare @Date date
SET @Date =GETDATE()
print @date
Declaration gives me the result : 2013-08-04
But I need also milliseconds and minutes.
How I can achieve this?
Declare as datetime2
rather than date
:
declare @Date datetime2
--^^^^^^^^^
SET @Date = SYSDATETIME()
print @date
Ref.: Data Types (Transact-SQL)
Updated: Replaced GETDATE()
with SYSDATETIME()
as mentioned by @Martin Smith