1.获取从右起3个字符
select Right('0'+department,3) from z_test
2.获取日期的月份
update [z_test] set [account]=convert(varchar(7),month(getdate()),特别是当月份为1~9月,MM为1位,10~12月MM为2位,采用1的办法可以取出2位月份
3.格式化字符串
convert(varchar(7),month(getdate()),将取出日期格式化为字符串
1.获取从右起3个字符
select Right('0'+department,3) from z_test
2.获取日期的月份
update [z_test] set [account]=convert(varchar(7),month(getdate()),特别是当月份为1~9月,MM为1位,10~12月MM为2位,采用1的办法可以取出2位月份
3.格式化字符串
convert(varchar(7),month(getdate()),将取出日期格式化为字符串