我的问题是如何执行特定的存储过程。当我执行特定事件时,它会给我一个错误:
过程或函数“StoredProcedureNames”需要参数“@empid”,但未提供该参数
我如何提供它?我的 SQL 是:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE StoredProcedureNames
@event tinyint,
@empid int,
@emp_name varchar(50),
@emp_phno char(10),
@emp_add nvarchar(75)
AS
IF @event = 1
BEGIN
INSERT INTO employee_test (emp_name,emp_phno,emp_add,empid )
VALUES (@emp_name,@emp_phno,@emp_add,@empid)
END
ELSE IF @event = 2
BEGIN
UPDATE employee_test SET
emp_name = @emp_name,
emp_phno = @emp_phno,
emp_add = @emp_add,
empid = @empid
WHERE (emp_Add = @emp_add
and emp_name = @emp_name
and emp_phno = @emp_phno
and empid = @empid )
END
ELSE IF @event = 3
BEGIN
select empid,emp_phno from employee_test
where (emp_Add = @emp_add or emp_name = @emp_name ) -- when i execute any event say exex sp 3 it shows a error
END
ELSE IF @event = 4
BEGIN
DELETE FROM employee_test
WHERE (emp_phno = @emp_phno or emp_name = @emp_name )
End
当我没有提供所有字段值时它显示的错误
将数据类型 varchar 转换为 int 时出错。
这是什么意思?