select str(year(getdate()))+ '-'+str(month(getdate()))
我这里年月取出来为什么是“2011- 5”啊。 中间这么有这么多空格啊?应该是“2011-5”呀。还有比如想是“2011-05”怎么弄呀。就是5月份显示的是05.
我这里年月取出来为什么是“2011- 5”啊。 中间这么有这么多空格啊?应该是“2011-5”呀。还有比如想是“2011-05”怎么弄呀。就是5月份显示的是05.
select cast(year(getdate()) as varchar)+ '-'+cast(month(getdate()) as varchar)
select cast(year(getdate()) as varchar)+ '-'+ right(('00' + cast(month(getdate()) as varchar)), 2)