先设置code不可重复,自动忽略
如果生成的串包含0,O,跳过
SET NOCOUNT ON;
declare @s varchar(8)
declare @i int
set @i=0
while(@i<1000000)
begin
set @s=upper(RIGHT(REPLACE(NEWID(), '-', ''),8));
if(CHARINDEX( '0',@s) = 0 and CHARINDEX( 'O',@s) = 0)
begin
insert into Fac_Code(code) values ( @s )
set @i=@i+@@ROWCOUNT;
end
end