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.
我将要导入数据,并且我有一个包含 2-4 位数字的字段。我需要将该数字更改为 x0001 或 x0200,具体取决于它是 1 还是 200。在 SQL Server 2005 中最简单的方法是什么?
这是一个选择 stmt,它将添加带有前导 0 的 x 和格式
select 'x' + RIGHT('000'+ CONVERT(VARCHAR,Num),4) from numbers