查询效果:
select a.CreationTime
,CONVERT(nvarchar(100), YEAR(a.CreationTime) )+ REPLICATE('0',2-len(CONVERT(nvarchar(100),MONTH(a.CreationTime))))+CONVERT(nvarchar(100),MONTH(a.CreationTime)) as yearMonthfrom dbo.myTable as a
查询到年月,月份前补零,然后年月拼接