我的存储过程中有些错误 [英] Some error in my Store procedure
本文介绍了我的存储过程中有些错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个名为TableC1的表,其中包含
> TableC1(R_Id int,C_name varchar(50),C_type varchar(50),......)
该表的功能:
I have one table named as TableC1 which contains
>TableC1(R_Id int, C_name varchar(50), C_type varchar(50), ......)
Function for this table:
ALTER FUNCTION [dbo].[fn_C_desig]
(@id varchar(15))
RETURNS varchar(50)
AS BEGIN
declare @name varchar(25)
declare @desig varchar(50)
select @name=Customer_name,@desig =Customer_type from tbl_ais_customer where reg_id=@id
return @name +'-'+ @desig
END
> Tabe2I(Id int不为null,名称nvarchar不为null,pending_status不为null,......)
>Tabe2I(Id int not null, Name nvarchar not null, pending_status not null, ......)
ALTER PROCEDURE [dbo].[p_regpending]
AS
BEGIN
SET NOCOUNT ON;
SELECT [NAME]+'--'+ISNULL([dbo].[fn_C_desig](refcode),'') AS [Name],Id FROM Table2I WHERE pending_status ='P'
END
但我收到此错误
"Msg 245, Level 16, State 1, Line 1
Conversion failed when converting the varchar value 'admin1234' to data type int.
"
请帮助我.
Please help me some one.
推荐答案
错误消息很清楚.某些列期望使用整数值,但是您提供的是字符串/varchar.现在,要查找错误的运行位置,请在查询分析器中双击该错误消息,它将向您显示错误的确切位置.
The error message is pretty clear. Some of the column is expecting integer value but you are supplying a string/varchar. Now to find where the error is run the query in a query analyzer and double click the error message and it will show you the line where the error exactly is.
这篇关于我的存储过程中有些错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文