DATEADD (datepart , number , date )
Arguments
-
datepart
-
Is the part of date to which an integer number is added. The following table lists all valid datepart arguments. User-defined variable equivalents are not valid.
datepart
|
Abbreviations
|
year
|
yy
, yyyy
|
quarter
|
qq
, q
|
month
|
mm
, m
|
dayofyear
|
dy
, y
|
day
|
dd
, d
|
week
|
wk
, ww
|
weekday
|
dw
, w
|
hour
|
hh
|
minute
|
mi
, n
|
second
|
ss
, s
|
millisecond
|
ms
|
microsecond
|
mcs
|
nanosecond
|
ns
|
-
number
-
Is an expression that can be resolved to an int that is added to a datepart of date. User-defined variables are valid.
If you specify a value with a decimal fraction, the fraction is truncated and not rounded.
-
date
-
Is an expression that can be resolved to a time, date, smalldatetime, datetime, datetime2, or datetimeoffset value. date
can be an expression, column expression, user-defined variable, or
string literal. If the expression is a string literal, it must resolve
to a datetime. To avoid ambiguity, use four-digit years. For information about two-digit years, see Configure the two digit year cutoff Server Configuration Option.
沒有留言:
張貼留言