October 1, 2017 at 7:21 pm
Jack 49290 - Thursday, March 30, 2017 3:45 PMCan you please elaborate onQ1? Based on the chart at the top, the shortest a DATETIMEOFFSET can be is 8 and the longest aDATETIME2 can be is 8 so “AT BEST†they are equal.
Apparently, this author doesn't respond to questions about his articles.
DATETIME2(3) and DATETIME2(4) both only take 7 bytes. DATETIME takes 8 bytes. DATETIMEOFFSET(3) and DATETIMEOFFSET(4) both take 9 bytes. Answer "B" is NOT the correct answer to the question. Answer "C" is the correct answer.
--Jeff Moden
Change is inevitable... Change for the better is not.
April 5, 2024 at 8:06 am
Incorrect answer to the first question. See:
declare @dt datetime = getdate(), @dt2 datetime2(3) = sysdatetime(), @DtOff datetimeoffset(3) = SysDateTimeOffset()
select datalength(@Dt) as [datetime], datalength(@Dt2) as [datetime2(3)], datalength(@DtOff) as [datetimeoffset(3)]
MORE space is C!
Microsoft SQL Server 2016 (SP2) (KB4052908) - 13.0.5026.0 (X64)
April 5, 2024 at 8:06 am
Incorrect answer to the first question. See:
declare @dt datetime = getdate(), @dt2 datetime2(3) = sysdatetime(), @DtOff datetimeoffset(3) = SysDateTimeOffset()
select datalength(@Dt) as [datetime], datalength(@Dt2) as [datetime2(3)], datalength(@DtOff) as [datetimeoffset(3)]
MORE space is C!
Microsoft SQL Server 2016 (SP2) (KB4052908) - 13.0.5026.0 (X64)
Viewing 3 posts - 16 through 17 (of 17 total)
You must be logged in to reply to this topic. Login to reply