【发布时间】:2014-02-12 06:01:10
【问题描述】:
我创建了一个存储过程,通过提供员工的收入来查找姓名和职务
Create PROCEDURE GetEmployeessalaryInOutputVariable
(
@Income INT, -- Input parameter, Income of the Employee
@FirstName VARCHAR (30) OUT, -- Output parameter to collect the Employee name
@Title VARCHAR (30)OUT -- Output Parameter to collect the Employee designation
)
AS
BEGIN
SELECT FirstName=@FirstName, Title=@Title
FROM Salaries WHERE @Income=Income
END
在此之后,我尝试按如下方式执行 Sp
Declare @FirstName as varchar(30) -- Declaring the variable to collect the Employeename
Declare @Title as varchar(30) -- Declaring the variable to collect the Designation
Execute GetEmployeessalaryInOutputVariable 500 , @FirstName output, @Title output
select @FirstName,@Title as Designation
上面的语句一写就报错
Invalid object name GetEmployeessalaryInOutputVariable
为什么程序已经创建并存在,但它的行为是这样的?
另外,如何运行查询以获得正确的结果?
【问题讨论】:
-
能否提供格式化后的代码?
标签: sql stored-procedures dynamic execute declare