--Try to make a script
--To get full info
--For a random Female (or Male) student.
--tfu@isb.bj.edu.cn
if object_id('outputtest') is not null
drop proc outputtest
go
create proc outputtest
@input_Gender Varchar(10),
@Output_Student_number int output
As
declare @FunctionVariable varchar(50)
set @FunctionVariable='9'
select Top 1 @Output_student_number=student_number
from students
where
grade_level=@FunctionVariable
and
Gender=@input_Gender
order by newid()
select @Output_student_number as IN_PROC_STDNUM
------------------------------------------------------------------------------
declare @input_new_Gender varchar(10)
declare @output_new_Student_number int
Set @input_new_Gender='F'
exec outputtest
@input_new_Gender,
@output_new_Student_number output
select
@Output_new_Student_number as OUTPUT_STUDNUM
select * from students s
where s.Gender=@input_new_Gender
and s.student_number=@output_new_Student_number