本文介绍了什么是错误....?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

declare @code varchar(50)
declare @new varchar(50)

declare udates cursor for 

SELECT DISTINCT E.C_EmpCode,replace(e.C_EmpCode,'0','100') FROM Tbl_Emp_Mst E
JOIN Tbl_User_Info U ON U.C_Code=E.C_EmpCode
JOIN Tbl_UserRights US ON US.c_userid=E.C_EmpCode
JOIN Tbl_FS_Mst FS ON FS.C_EmpNo=FS.C_EmpNo
JOIN tbl_fs_emp_rel FSM ON FSM.c_emp_code=E.C_EmpCode
JOIN FSHEIRARCHY FSH ON FSH.empcode=E.C_EmpCode

open updates
fetch next from updates into @code,@new
while @@FETCH_STATUS=0
begin
update Tbl_Emp_Mst set C_EmpCode=@new where C_EmpCode=@code
--update Tbl_FS_Mst set C_EmpNo=@new where C_EmpNo=@code
update tbl_fs_emp_rel set c_emp_code=@new where c_emp_code=@code
update fsheirarchy set empcode=@new where EmpCode=@code

update Tbl_User_Info set C_Code=@new where C_Code=@code
update Tbl_User_Info set C_UserID=@new where C_UserID=@code
update Tbl_User_Info set C_Password=@new where C_Password=@code

update Tbl_UserRights set c_userid=@new where c_userid=@code

fetch next from updates into @code,@new
end
close updates
deallocate updates



执行脚本时出错。


error while executing script.

Msg 16916, Level 16, State 1, Line 6
A cursor with the name 'updates' does not exist.
Msg 16916, Level 16, State 1, Line 14
A cursor with the name 'updates' does not exist.
Msg 16916, Level 16, State 1, Line 30
A cursor with the name 'updates' does not exist.
Msg 16916, Level 16, State 1, Line 31
A cursor with the name 'updates' does not exist.

推荐答案

declare udates cursor for
declare updates cursor for



这篇关于什么是错误....?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 09:11