SQL SERVER 利用字符串函数输出菱形图案

declare @count int;
set @count=1;
while @count<6
begin
  print space(5-@count)+replicate('#',@count*2-1);
  set @count=@count+1;
end
while @count>0
begin
  print space(7-@count)+replicate('#',@count*2-5);
  set @count=@count-1;
end
    #
   ###
  #####
 #######
#########
 #######
  #####
   ###
    #

你可能感兴趣的:(SQL)