创建触发器吧...
虽然不是很好..但是效果能达到..
把我下面的字段 替换一下吧
CREATE TRIGGER [test_insert] ON [dbo].[myTable]
INSTEAD OF INSERT
AS
declare @str varchar(20)
declare @i integer
set @str = 'T'+left(convert(char,getdate(),112),4)+'00'
select @i=isnull(max(cast(right(rtrim(id),len(id)-7) as integer)),0) from
(select id from myTable where id like @str+'%') a
set @i=@i+1
INSERT INTO myTable
SELECT @STR++cast(@i as char)as id,name from inserted
[[it] 本帖最后由 天下云 于 2008-7-9 17:22 编辑 [/it]]