日期:2014-05-18  浏览次数:20549 次

SQL 存储过程如何赋值
Fraction --每个人语文分数字段int 形
SQL code


declare @num int --总数
set @num= select sum(Fraction) from Student where names='小红'




总说 关键字 'select' 附近有语法错误。 
怎么回事,总分数也查出来了,网上赋值也是这样的,到底错在哪里了?

------解决方案--------------------
SQL code

declare @num int --总数
select @num= sum(Fraction) from Student where names='小红'

------解决方案--------------------
SQL code
declare @num int --总数
set @num= (select sum(Fraction) from Student where names='小红')