---通过set赋值,与select赋值的区别。
declare @a int
--set @a=(select count(*) from TblStudent)
select @a=count(*) from TblStudent
print @a


--set @a=1
--select @a=1


declare @a int
--当通过set为变量赋值的时候,如果查询语句返回的不止一个值,那么报错!!!!!
--set @a=(select tsage from TblStudent)

--当通过select为变量赋值的时候,如果查询语句返回的不止一个值,那么会将最后一个结果赋值给该变量
select @a=tsage from TblSTudent
print @a

相关文章:

  • 2022-01-02
  • 2022-12-23
  • 2021-09-01
猜你喜欢
  • 2021-10-14
  • 2021-09-02
  • 2022-12-23
  • 2021-09-22
  • 2022-01-05
  • 2022-12-23
  • 2022-02-05
相关资源
相似解决方案