exec master.sys.sp_MSforeachdb
'
use [?];
if exists
begin
create proc toupdateuserlimit
@totaluser int,
@msgcode varchar(10)
as
begin
update tbl_controlpanel_mst set n_webuserLimit=@totaluser+(select max(n_webuserLimit) from tbl_controlpanel_mst)
if @@ERROR<>0
begin
set @msgcode=''9012''
end
else
begin
set @msgcode=''90012''
end
end
end';
when executing this query ian getting error like in below..
Msg 156, Level 15, State 1, Line 4
Incorrect syntax near the keyword 'begin'.
Msg 137, Level 15, State 2, Line 12
Must declare the scalar variable "@totaluser".
Msg 137, Level 15, State 1, Line 15
Must declare the scalar variable "@msgcode".
Msg 137, Level 15, State 1, Line 19
Must declare the scalar variable "@msgcode".
Msg 156, Level 15, State 1, Line 4
Incorrect syntax near the keyword 'begin'.
Msg 137, Level 15, State 2, Line 12
Must declare the scalar variable "@totaluser".
Msg 137, Level 15, State 1, Line 15
Must declare the scalar variable "@msgcode".
Msg 137, Level 15, State 1, Line 19
Must declare the scalar variable "@msgcode".
Msg 156, Level 15, State 1, Line 4
Incorrect syntax near the keyword 'begin'.
Msg 137, Level 15, State 2, Line 12