我有这样的查询:
DECLARE @MilestoneName VARCHAR( 50 );
SELECT @MilestoneName = 'Milsetone' + CAST( 001 AS VARCHAR );
这为我提供了结果Milestone1
但我希望结果为Milestone001
我怎样才能做到这一点?
答案 0 :(得分:2)
希望这有帮助
DECLARE @MilestoneName VARCHAR( 50 )
SELECT @MilestoneName = 'Milestone' + RIGHT('000'+ CONVERT(VARCHAR,001),3)
答案 1 :(得分:1)
SELECT @MilestoneName = 'Milestone' + RIGHT( 1000 + 001, 3 );