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.
我想在 SQL Server 中格式化数字。例如,
SET @B = '123456'
转换成
@B = '1234.56'
怎么做 ?
问候,
只需将您的数字除以 100,您就会得到结果。
update yourtable set B=B/100
或者看起来你的 B 变量是 varchar 你可以试试这个。
set @B=convert(varchar,cast(@B as decimal) / 100);
使用这样的东西
select @B/1000.000;
或简单
select round(@B,2,1)