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!
我们所有人都知道系统函数DATEADD函数(作为例子)。这个函数有3个参数,第一个对我来说很奇怪。我在Google上查找了第一个参数的参数类型(在对象资源管理器窗口中显示为varchar),但没有找到任何内容!
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:
如果回答其中一个问题,我的问题可以回答:
- How can I see system functions definition?
- 如何查看系统功能定义?
- What's that
DAY
in above statement and how can I write a function likeDATEADD
to accept such parameter? - 在上面的语句中是什么日子,我如何编写像DATEADD这样的函数来接受这样的参数?
- If it's an enum, how can I define an enum in TSQL?
- 如果它是枚举,我如何在TSQL中定义枚举?
1 个解决方案
#1
1
Day is a type and its values can be:
Day是一种类型,其值可以是:
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
#1
1
Day is a type and its values can be:
Day是一种类型,其值可以是:
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