【2018-01-19】Sql Server-TSQL基本编程
--定义变量 --int a; declare @a nvarchar(200); declare @b nvarchar(200); declare @c int; --赋值 --a=""; set @a='haha'; select @b=MAX(DEGREE) from Score select @c=1; --输出 --console.write(s); select @a--表格结果形式, print @b--消息形式 select @c --分值语句 declare @x int; declare @y int; select @x=1; select @y=2; if @x>@y begin select 'x比y大' end else begin select 'y比x大' end --循环语句 declare @aa int; select @aa=1; while @aa<=10 begin select @aa; select @aa=@aa+1; end