如何使用sql server 2008中的查询获取一年中的一年和一天
例如:
11: YY (Year)
292: Day of the year .31 + 28 +31 + 30 + 31 + 30 +31 + 31 +30 +19: 19th October being the 292 day in this year
需要输出
11, 292
答案 0 :(得分:3)
SELECT RIGHT(YEAR(GETDATE()),2), DATEPART (DAYOFYEAR,GETDATE())
答案 1 :(得分:0)
怎么样
select
year(thedatetime) - 2000,
1 + datediff(day, cast(year(thedatetime) as varchar(4)) + '0101', thedatetime)