alter table tb add id int update tb set id=substring(LTrim(abs(checksum(newid()))),0,6)
checksum(newid()) 这个的数据是唯一的,但是只取其中的一部分之后,就把重复的可能性加大了。