-----------------------------前提条件----------------------------
--insert into stuInfo (stuName, stuNo, stuAge, stuSex, stuAddress)
--values ('张秋丽','s25301',18,'男','北京海淀')
--insert into stuInfo (stuName, stuNo, stuAge, stuSex, stuAddress)
--values ('李斯文','s25303',22,'女','河南洛阳')
--insert into stuInfo (stuName, stuNo, stuAge, stuSex, stuAddress)
--values ('李文才','s25302',31,'男',default)
--insert into stuInfo (stuName, stuNo, stuAge, stuSex, stuAddress)
--values ('欧阳俊雄','s25304',28,'男','新疆')
------------------------------------------------------------------
-------使用变量
--/*---查找‘李文才’的信息---*/
--declare @name varchar(8)
--set @name='李文才'--使用set赋值
--select * from stuInfo where stuName=@name
--/*---查询‘李文才’的左右同桌---*/
--declare @seat int---座位号
--select @seat=stuSeat from stuInfo where stuName=@name---使用select赋值
--select * from stuInfo where (stuSeat=@seat+1) or (stuSeat=@seat-1)
--go
-----输出语句
--------语法:print 局部变量或字符串 ---- select 局部变量 as 自定义列名
--print '服务器的名称:'+@@servername
--select @@SERVERNAME as '服务器名称'
--insert into stuInfo (stuName, stuNo,stuSex, stuAge)
--values('梅超风','s25318','女',23)
--print '当前错误号'+convert(varchar(5),@@error)---如果大于0,表示上一条语句执行有错误
--print '刚才报名的学员,座位号为'+convert(varchar(5),@@identity)
--update stuInfo set stuAge=85 where stuName='李文才'
--print '当前错误号'+convert(varchar(5),@@error)
--print 'SQL Server 的版本'+@@version
--go
-------------------------------------------------------------------------