查询出其中成绩(score)小于等于60的学生信息保存至表变量@tempTable中,当学生成绩为空时,成绩记为0。
declare @tempTable table(
stuname nchar(10),
stuage int,
stuscore float);
insert into @tempTable
select name,age,ISNULL(score,0) from tb_Student
where ISNULL(score,0)<=60
select * from @tempTable