create procedure getUserName @userid int, @username varchar(30) output as begin select @username=name from person where id=@userid end --declare @username varchar(30) --exec getUserName 1 ,@username output --select @username; create proc findSomeUser(@begin int ,@end int) as begin select * from person where id between @begin and @end end --select name from exec findSomeUser 2,3;