declare @date varchar(50)='2020-10-03'
print Month(dateadd(month,-1,Convert(datetime,@date)))

print (Convert(int,Substring(@date,6,2))-1)

 第一种方法保险一点,因为涉及到跨年的情况,如果确认是一年的话,使用第二种方便一点

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-02-05
  • 2022-12-23
  • 2021-10-27
  • 2021-09-23
  • 2021-07-23
相关资源
相似解决方案