506941763lcj

T-SQL编程

一:变量的分类:

1局部变量(过程中使用)

a)局部变量标记语法:@StuName。

b)先声明,后赋值使用(声明用declare)

DECLARE @变量名 数据类型

eg;declare @studentName varchar(10),@studentId int

eg:赋值方法

SET @变量名 =值或SELECT @变量名=值

select@studentName='张三'

select StuId,StuName from Stus where StuName=@studentName

select @StuId=studentId from Stus where StuName=@studentName

 

--查询临近元素

select StuId,StuName from Stus where StuAddr=(@StuId+1)or StuId=(@studengId+1)

2全局变量(随时可用)

a)全局变量标记语法:@@StuName。

b)可读取,不可修改其值。

 

发表于 2018-07-01 18:23 lfylcj 阅读(...) 评论(...) 编辑 收藏
 

分类:

技术点:

相关文章:

  • 2021-12-06
  • 2021-06-30
  • 2021-09-25
  • 2022-12-23
  • 2022-12-23
  • 2022-01-19
  • 2022-01-05
  • 2021-07-26
猜你喜欢
  • 2021-11-22
  • 2021-05-28
  • 2021-12-01
  • 2021-07-16
  • 2021-08-17
相关资源
相似解决方案