日期:2014-05-17 浏览次数:20785 次
DECLARE @Count INT=1;
DECLARE @Cols INT=10;
--IF(@Count%2=1)
WHILE @Count<=@Cols
BEGIN
IF(@Count%2=1)
PRINT SPACE((@Cols-@Count)/2)+REPLACE(SPACE(@Count),' ','*')+SPACE((@Cols-@Count)/2)
SET @Count=@Count+1
END
/*
*
***
*****
*******
*********
*/
DECLARE @Count INT=1;
DECLARE @Cols INT=10;
--IF(@Count%2=1)
WHILE @Count<=@Cols
BEGIN
IF(@Count%2=1)
PRINT SPACE((@Cols-@Count)/2)+REPLACE(SPACE(@Count),' ','*')+SPACE((@Cols-@Count)/2)
SET @Count=@Count+1
END
SET @Count=@Count-2
WHILE @Count>=0
BEGIN
IF(@Count%2=1)
PRINT SPACE((@Cols-@Count)/2)+REPLACE(SPACE(@Count),' ','*')+SPACE((@Cols-@Count)/2)
SET @Count=@Count-1
END
/*
*
***
*****
*******
*********
*********
*******
*****
***
*
*/