效果:
![SQL时间函数应用(时间、季度、旬、月、星期) - king5439 - king5439 SQL时间函数应用(时间、季度、旬、月、星期) - king5439 - king5439](http://img0.ph.126.net/dCul_qHn0-NEKxpClmfUPA==/6630293709514773111.png)
declare @beginDate date;
set @beginDate=getdate();
select
convert(varchar(10),@beginDate,112) as datekey,
year(@beginDate) as NIAN,
datepart(quarter,@beginDate) as JIDU,
case
when datepart(quarter,@beginDate)=1 then '第一季度'
when datepart(quarter,@beginDate)=2 then '第二季度'
when datepart(quarter,@beginDate)=3 then '第三季度'
else '