declare

--第一种
declare @i int
set @i= (select COUNT(*) from t8)
select @i
--第二种
declare @i int
select @i= COUNT(*) from t8
print @i

if else

declare @num int
select @num=COUNT(*) from t8
if(@num>2)
    begin
        print '大于2'
    end
else    
    begin    
        print '小于2'
    end

while

--输出0-100
declare @i int
set @i=0
while(@i<=100)
begin
    print @i
    set @i=@i+ 1
end

 

相关文章:

  • 2021-06-22
  • 2022-12-23
  • 2021-09-21
  • 2021-12-03
  • 2021-12-19
猜你喜欢
  • 2022-01-18
  • 2021-11-29
  • 2021-07-04
  • 2021-07-30
  • 2021-06-24
相关资源
相似解决方案