Simple Look/Understanding of Date & Time data types in SQL Server
Execute below SQL & Notice output
SELECT CAST(GETDATE() AS TIME) TIME
/* Accuracy upto 100 nanosecond*/
SELECT CAST(GETDATE() AS DATE) DATE /* Accuracy upto 1 day*/
SELECT CAST(GETDATE() AS SMALLDATETIME) SMALLDATETIME /* Accuracy upto 1 Minute */
SELECT CAST(GETDATE() AS DATETIME) DATETIME /* Accuracy upto 1 Minute 0.00333 second */
SELECT CAST(GETDATE() AS DATETIME2) DATETIME2 /* Accuracy upto 100 nanoseconds */
SELECT CAST(GETDATE() AS DATETIMEOFFSET) DATETIMEOFFSET /* Accuracy upto 100 nanoseconds */
No comments :
Post a Comment