SQL server入门-3,T-SQL编程
>[1]局部变量
declare @name varchar(8)-----name为变量名,varchar为数据类型
局部变量赋值:
1. set @name = value
2. select @name = value
declare @name varchar(8)
set @name = '李文才'
select * from stuinfo where stuname = @name
declare @seat int
set @seat = stuseat from stuinfo where stuname = @name
select * from stuinfo where (stuseat = @seat+1) or (stuseat = @seat-1)
go