尝试使用
computed columnMSDN
CREATE TABLE Yourtablename( ID int IDENTITY (1,1) NOT NULL, InvoiceID AS 'INV'+ right('000000'+cast(ID as varchar(20)),7) PERSISTED);SQLFIDDLE演示
关于为什么你需要让你的计算列的详细信息
persisted检查
这里

尝试使用
computed columnMSDN
CREATE TABLE Yourtablename( ID int IDENTITY (1,1) NOT NULL, InvoiceID AS 'INV'+ right('000000'+cast(ID as varchar(20)),7) PERSISTED);SQLFIDDLE演示
关于为什么你需要让你的计算列的详细信息
persisted检查