create procedure usp_name
@score int
as
select studentname,StudentResult from student,result
where student.studentno=result.studentno
and StudentResult>@score
exec usp_name @score=90
--带OUT参数的存储过程
create procedure usp_GetPageListS2226
@pageIndex int,
@pageSize int,
@totalRecords int out,
@totalPages int out,
as
SELECT @totalRecords=COUNT(1)
FROM student
SELECT *FROM
(
SELECT *,ROW_NUMBER over(order by studentno) as myid
FROM student
) as temp
WHERE myid between (@pageIndex-1)*@pageSize+1 AND @pageIndex*@pageSize
declare @record int
declare @page int
EXEC usp_GetPageListS2226 2,3,@record out,@page OUT
print @record
print @page
--带参数的存储过程
CREATE PROCEDURE usp_SelectStudentInfo
@score int
as
if(@score<0 OR @score>100)
BEGIN
print '.........'
END
else
BEGIN
SELECT studentname,studentresult
FROM student,result
WHERE stdentno=result.studentno
AND studentresult>@score
END
EXEC sup_SelectStudentInfo-20