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函数可以将数字转换为两位数,所以我可以得到 01 为 1。
您需要将值转换为字符串。你可以用LPAD()这个,
LPAD()
这将是:
SELECT LPAD(1, 2, '0');
有一种方法可以按照您的要求进行。这是一篇解释它的帖子,假设您使用的是 SQL Server
通过在 SQL Server 中使用前导零填充来格式化数字