且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在 T-SQL 中将 int 转换为零填充字符串?

更新时间:2023-01-30 13:14:08

Declare @MyInt integer Set @MyInt = 123
Declare @StrLen TinyInt Set @StrLen = 8

Select Replace(Str(@MyInt, @StrLen), ' ' , '0')