有在執行該代碼時發生的錯誤的數目:在@emp噸-SQL代碼:在@emp語法錯誤 - 必須聲明標量變量@Handle
正確語法 - 線11
必須聲明標量變量@Handle - 線19
必須聲明標量變量@Handle - 線32
/*Delete the selected list */
use database
/* create procedure with in scehema */
Create procedure schema.Proc_delete_emp
@emp varchar(50) =0
@displayname nvarchar(50)=0
@userId int =0
AS
BEGIN
/* Internal variables */
DECLARE @Handle INT
@emp =select emp from dbo.emp_list
/*definition of emp_list table (userid,emp)*/
/* Insert the list into audit table */
INSERT INTO schema.tbl_audit(@emp, @displayname, @UserID)
VALUES('emp', CURRENT_USER, system_user)
/* Get Handle */
SELECT @Handle = SCOPE_IDENTITY() -- get handle
Select handle
From schema.tbl_emp_list
Where delete_handle = 0 and card_type = 'n' --/** Normal**/
/* delete the inserted list from the original table */
Delete from dbo.emp_list
Where pan in (select card_ID from schema.tbl_emp_list)
/* Update table inside the schema */
Update schema.tbl_emp_list
Set delete_handle = @handle
Where delete_handle=0 and card_type ='n';
end
存儲過程的參數有什麼問題/問題/挑戰? ?!? –
爲什麼你提供參數給SP?你不要在任何地方使用它們。 –