--【导例4.9】如何查询某日期的年份(月份、几号)、某时间的几点(几分、几秒)？

select year('2004-4-6') as '年份'
select month('2004-4-6') as '月份'
select day('2004-4-6') as '几号'
select getdate() as '现在'
select datepart(yy, getdate()) as '现在是何年' 
select datepart(mm, getdate()) as '现在是几月'
select datepart(dd, getdate()) as '现在是几号'
select datepart(hh, getdate()) as '现在是几时'
select datepart(n, getdate()) as '现在是几分'
select datepart(s, getdate()) as '现在是几秒'
