Misschien kunt u SQL met parameters overwegen, als u dynamische query's moet uitvoeren:
CREATE PROCEDURE sp_calculatesalary(@EmployeeId as int)
as
begin
declare @dynsql varchar(500)
declare @params nvarchar(500)
declare @salary money
declare @username varchar(50)
set @dynsql='Select @sal=Salary,@usernm=Username from employee where [email protected]'
set @params='@empID int, @sal money OUTPUT, @usernm varchar(50) OUTPUT'
exec sp_executesql @dynsql, @params, @[email protected], @[email protected] OUTPUT, @usernm = @username OUTPUT
SELECT @salary, @username
end