时间:2021-07-01 10:21:17 帮助过:195人阅读
--用法例子
CREATE TABLE #T ( val NVARCHAR(50) NOT NULL ) INSERT INTO #t SELECT ‘35040112‘ UNION ALL SELECT ‘35040112‘ UNION ALL SELECT ‘35040112‘ UNION ALL SELECT ‘35040102‘ UNION ALL SELECT ‘35040102‘ UNION ALL SELECT ‘35040102‘ UNION ALL SELECT ‘35040102‘ UNION ALL SELECT ‘35040105‘ UNION ALL SELECT ‘35040105‘ UNION ALL SELECT ‘35040105‘ UNION ALL SELECT ‘35040105‘ UNION ALL SELECT ‘35040105‘ UNION ALL SELECT ‘35040105‘ UNION ALL SELECT ‘35040105‘ UNION ALL SELECT ‘35040105‘ UNION ALL SELECT ‘35040105‘ UNION ALL SELECT ‘35040105‘ UNION ALL SELECT ‘35040105‘ SELECT val AS 查出的料号,val +‘-‘+ right(cast(power(10,2) as varchar) +CAST(ROW_NUMBER() OVER (PARTITION BY val ORDER BY val) AS NVARCHAR),2) AS 需变成的这种 FROM #T
sql语句格式化数字(前面补0)
标签:格式化数字 nvarchar sql nio ima har logs table class