The XP.DLL extended stored procedure xp_echo is an example of how to use input and output parameters to pass information to and from an extended stored procedure, in the same way as you would pass information to and from a standard SQL Server stored procedure. The xp_echo extended stored procedure accepts a user-specified input parameter and returns the value of the input parameter as an output parameter. For example:
declare @out char(4) declare @in int select @in=999 execute xp_echo @in, @param=@out output select @out
In this example, the caller first declares the parameters to be used. The EXECUTE statement passes the value of @in to the xp_echo procedure and then saves the value that the procedure returns as @out, using standard SQL Server stored procedure syntax for passing the input value and for saving the return parameter.