Reputation: 758
All of us know the system function DATEADD
function (as an example). this function has 3 parameters which the first one is so strange for me. I looked on the Google so much for finding out the parameter type of the first parameter (which is shown varchar
in Object Explorer window), but found nothing!
I think it's a kind of Enum used in this function because the usage is very similar to Enum usage:
Print DATEADD(DAY,1,GETDATE()) -- What's that DAY?
My question can be answered if one of this questions be replied:
DAY
in above statement and how can I write a function like DATEADD
to accept such parameter?Upvotes: 4
Views: 737
Reputation: 3299
Day is a type and its values can be:
yy, yyyy: year
qq, q: quarter
mm, m: month
dy, y: day of year
dd, d: day
wk, ww: week
dw, w: weekday
hh: hour
mi, n: minute
ss or s: second
ms: millisecond
mcs: microsecond
ns: nanosecond
Upvotes: 1