如何调用下面存储过程并让错误输出(输出@error_msg):
CREATE PROCEDURE [dbo].[USP3_SPECXUserChangePassword]
@company_id int, 
    @operator_no  int,                 
    @operator_pass      varchar(32),           
    @oper_type          smallint,               

@new_password       varchar(32), 
@old_password       varchar(32),            
@client_id          int,                   
@error_msg          varchar(255) output     -- 错误信息返回
AS 
set nocount on 
declare @original_password  varchar(64)    
declare @new_password2      varchar(32)
declare @user_code  varchar(100)
select @original_password = MM, @user_code = rtrim(ltrim(KHDM))
from usiKHKHDJ where KHID = @client_id
if @@error != 0 or @@rowcount < 1
begin
select @error_msg = '[1205001]无此客户:[' + convert(varchar, @client_id) + ']'
return 1205001
end

if (@oper_type = '1')
begin
if rtrim(ltrim(@original_password)) != rtrim(ltrim(@old_password))
begin
select @error_msg = '[1205002]密码校验不匹配!'
return 1205002
end

select @new_password2 = [dbo].[uf_getuserpass] (@user_code, @new_password)
end  else
select @new_password2 = [dbo].[uf_getuserpass] (@user_code, @new_password)

update usiKHKHDJ set MM=isnull(@new_password2, ''), XGSJ=getdate(), JSID=dbo.uf_getsysid()
    where KHID = @client_id
    if @@error !=0 or @@rowcount != 1
    begin
     select @error_msg = '[1205003]修改客户密码错误!'
     return 1205003
    end

解决方案 »

  1.   

    declare @msg varchar(255)exec usp3_specxuserchangepassword 1,'aa',1,'xx','yy',2,@msg output将这些值分别改为你的值
      

  2.   


    declare @msg varchar(100)
    exec USP3_SPECXUserChangePassword null,null,null,null,null,null,null,@msg output
    select @msg
      

  3.   

    DECLARE
    @error_msg          varchar(255);  -- 保存输出的变量

    EXEC [dbo].[USP3_SPECXUserChangePassword] 
    @company_id = 1, 
      @operator_no = 2,                
      @operator_pass     = 'ABC',          
      @oper_type          = 1,              @new_password      = 'ABC', 
    @old_password      ='ABC',            
    @client_id          =1,                  
    @error_msg         = @error_msg output;    -- 错误信息返回 SELECT 输出 = @error_msg;
      

  4.   

    DECLARE @ERR varchar(255)
    EXEC [dbo].[USP3_SPECXUserChangePassword] 1,2,'ABC',4,'BCD','ABC',7,@ERR OUTPUT
    SELECT @ERR
      

  5.   

    declare 
      @company_id  int, 
      @operator_no   int,                
      @operator_pass varchar(32),          
      @oper_type     smallint,              
      @new_password  varchar(32), 
      @old_password  varchar(32),            
      @client_id     int,                  
      @error_msg     varchar(255)select
       @company_id = ..
      ,@operator_no = ..
      ,@operator_pass = ..
      ,@oper_type = ..
      ,@new_password = ..
      ,@old_password = ..
      ,@client_id = ..exec [dbo].[USP3_SPECXUserChangePassword] 
      @company_id,
      @operator_no,
      @operator_pass,
      @oper_type,
      @new_password,
      @old_password,
      @client_id,
      @error_msg output
      

  6.   

    declare @msg varchar(255) 
    exec usp3_specxuserchangepassword 1,'aa',1,'xx','yy',2,@msg output 
      

  7.   


    declare @error_msg varchar(255)
    exec usp3_specxuserchangepassword 1,'aa',1,'xx','yy',2,@error_msg output 
    select @error_msg