SQL自动生成A到Z二十六个英文字母

if object_id('#tempdriveinfo') is not null
   drop table #tempdriveinfo
create table #tempdriveinfo 
(   
  [driveinfoid] tinyint identity primary key not null,
  [drivename] nvarchar(10)    
)  
declare @firstcapitalletters int
set @firstcapitalletters = 65  
   
while @firstcapitalletters <= 90
begin
    insert into  #tempdriveinfo ([drivename]) values (char(@firstcapitalletters))
    set @firstcapitalletters = @firstcapitalletters + 1
end
select * from  #tempdriveinfo

 

posted @ 2016-01-16 14:47  tc310  阅读(1511)  评论(0编辑  收藏  举报