Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有列 stsmm ,它是一个月整数。我需要它以MM的形式。
我试过这个:RIGHT('0' || cast(stsmm as char(2)), 2)但它不起作用。
RIGHT('0' || cast(stsmm as char(2)), 2)
谢谢
尝试使用这个:
select right(cast(100 + yourmonthcolumn as char(3)), 2)
这种方式总是在MM中返回
需要是RIGHT('0' || cast(stsmm as varchar(2)), 2)
RIGHT('0' || cast(stsmm as varchar(2)), 2)