2012-06-19 57 views

回答

0
SELECT RIGHT('00000' + CAST(ID AS VARCHAR(5)), 5) + RefNum 
1

你可以使用這樣的事情:

ALTER TABLE dbo.YourTable 
ADD FormattedColumn AS RIGHT('00000' + CAST(ID AS VARCHAR(5)), 5) + RefNum PERSISTED 

基本上,它轉換IDVARCHAR(5),在前面加上00000,然後抓住右邊的5個最字。