sql语句自动生成卡号与密码,代码如下:
复制代码 代码示例:
declare @i bigint,@j int,@str nvarchar(160) ,@int_temp int,@str_temp nvarchar(10),@Card_NO nvarchar(10)
;
set @i = 10200001;
while (@i<=10250000)
begin
set @j = 0;
set @str='';
while (@j<=16)
begin
set @int_temp=rand()*9;
set @str_temp=str(@int_temp);
set @str=@str+@str_temp;
set @j=@j+1;
end
set @Card_NO=str(@i);
set @str=replace(@str,' ','');
insert into IN_Card (Card_No,[Password],[Value])values(@Card_NO,@str,100);
set @i=@i+1;
end