Questions tagged [datetime2]
The datetime2 tag has no usage guidance.
4
questions
57
votes
6
answers
69k
views
How to combine date and time to datetime2 in SQL Server?
Given the following components
DECLARE @D DATE = '2013-10-13'
DECLARE @T TIME(7) = '23:59:59.9999999'
What is the best way of combining them to produce a DATETIME2(7) result with value '2013-10-13 ...
22
votes
1
answer
22k
views
datetime2(0) vs datetime2(2)
According to the documentation datetime2 (Transact-SQL):
Storage size
6 bytes for precisions less than 3.
7 bytes for precisions 3 and 4.
All other precisions require 8 bytes.
The size of ...
4
votes
1
answer
3k
views
What does 0 in DATEDIFF(MINUTE, 0, <Date>) actually mean?
So, our data team asked for some help in solving a problem they had. I eventually tracked it down to some really out of range data (1/1/0001) and a DATEDIFF function they were using. While I've ...
2
votes
1
answer
6k
views
Help with out-of-range value
I have this query that is giving me an error
The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.
Query:
select
COUNT(*)
from
dbo.patient
...