不要建这样一个字段。需要时查询生成就行了:
select * , 'old'+right('0000'+cast(id as varchar(4)),4) as new_id from test

解决方案 »

  1.   

    写触发器:
    create trigger aaa on text
    for insert
    AS
      update Test
      set NewID='OLD'+right('00000'+cast(id as varchar(5)),5)
      where ID in (select ID from inserted)
      

  2.   

    --用计算列就可以了:
    alter table 你的表 add NewID as 'OLD'+right('0000'+cast(id as varchar),4)
      

  3.   

    right('0000'+cast(id as varchar),4)不满四位的,左侧用0填充。又学了一招!
               :)