Here's a very simple function to return student id by name.The function works but I have trouble getting use of it:
--function to find student id by name (works)
create function findStudent (@name nvarchar(15), @familyName nvarchar(15))
returns tinyint
as
begin
declare @id tinyint
select @id = (select teaID from Tea where teaFirstName = @name and teaLastName = @familyName)
return @id
end;
--using the function (doesn't work)
declare @id tinyint
select @id = (execute findStudent 'Arash', 'Mitooie')
print @id