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 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
But i got this error
"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.