declare @zmb table (zm char)
declare @i int
set @i=ascii('A')
while(@i<=ascii('Z'))
begin
insert into @zmb values(char(@i))
set @i=@i+1
end
--生成100个10个字符的字符串
declare @n int,@m int
declare @tb table(zfc char(10))
declare @zfch varchar(10)
set @n=1
set @m=1
set @zfch=''
set nocount on
while @n<=100
begin
while @m<=10
begin
set @zfch=@zfch+(select top 1 zm from @zmb order by newid())
set @m=@m+1
end
insert into @tb values(@zfch)
set @zfch=''
set @m=1
set @n=@n+1
end
set nocount off
select * from @tb
评论